Mercurial > emacs
annotate lisp/x-dnd.el @ 111890:ba688f8ab22c
Small ps-print fixes.
* lisp/ps-print.el (ps-line-lengths-internal, ps-nb-pages):
Ensure ps-footer-font-size-internal is initialized.
Call ps-get-page-dimensions before trying to use ps-font-for-text.
author | Glenn Morris <rgm@gnu.org> |
---|---|
date | Wed, 01 Dec 2010 20:06:52 -0800 |
parents | e76d2bc9dbbe |
children | 280c8ae2476d 376148b31b5e |
rev | line source |
---|---|
109259
e76d2bc9dbbe
* dnd.el, font-setting.el, x-dnd.el: Use utf-8 coding (for author name).
Glenn Morris <rgm@gnu.org>
parents:
106815
diff
changeset
|
1 ;;; x-dnd.el --- drag and drop support for X -*- coding: utf-8 -*- |
53789
7efe8089eadf
* x-dnd.el: New file for drag and drop.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
2 |
106815 | 3 ;; Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010 |
104823
68150c643e2e
Use default-value rather than default-enable-multibyte-characters.
Glenn Morris <rgm@gnu.org>
parents:
102285
diff
changeset
|
4 ;; Free Software Foundation, Inc. |
53789
7efe8089eadf
* x-dnd.el: New file for drag and drop.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
5 |
109259
e76d2bc9dbbe
* dnd.el, font-setting.el, x-dnd.el: Use utf-8 coding (for author name).
Glenn Morris <rgm@gnu.org>
parents:
106815
diff
changeset
|
6 ;; Author: Jan Djärv <jan.h.d@swipnet.se> |
53789
7efe8089eadf
* x-dnd.el: New file for drag and drop.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
7 ;; Maintainer: FSF |
7efe8089eadf
* x-dnd.el: New file for drag and drop.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
8 ;; Keywords: window, drag, drop |
7efe8089eadf
* x-dnd.el: New file for drag and drop.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
9 |
7efe8089eadf
* x-dnd.el: New file for drag and drop.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
10 ;; This file is part of GNU Emacs. |
7efe8089eadf
* x-dnd.el: New file for drag and drop.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
11 |
94678
ee5932bf781d
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
93975
diff
changeset
|
12 ;; GNU Emacs is free software: you can redistribute it and/or modify |
53789
7efe8089eadf
* x-dnd.el: New file for drag and drop.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
13 ;; it under the terms of the GNU General Public License as published by |
94678
ee5932bf781d
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
93975
diff
changeset
|
14 ;; the Free Software Foundation, either version 3 of the License, or |
ee5932bf781d
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
93975
diff
changeset
|
15 ;; (at your option) any later version. |
53789
7efe8089eadf
* x-dnd.el: New file for drag and drop.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
16 |
7efe8089eadf
* x-dnd.el: New file for drag and drop.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
17 ;; GNU Emacs is distributed in the hope that it will be useful, |
7efe8089eadf
* x-dnd.el: New file for drag and drop.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
18 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of |
7efe8089eadf
* x-dnd.el: New file for drag and drop.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
19 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
7efe8089eadf
* x-dnd.el: New file for drag and drop.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
20 ;; GNU General Public License for more details. |
7efe8089eadf
* x-dnd.el: New file for drag and drop.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
21 |
7efe8089eadf
* x-dnd.el: New file for drag and drop.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
22 ;; You should have received a copy of the GNU General Public License |
94678
ee5932bf781d
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
93975
diff
changeset
|
23 ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. |
53789
7efe8089eadf
* x-dnd.el: New file for drag and drop.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
24 |
7efe8089eadf
* x-dnd.el: New file for drag and drop.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
25 ;;; Commentary: |
7efe8089eadf
* x-dnd.el: New file for drag and drop.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
26 |
7efe8089eadf
* x-dnd.el: New file for drag and drop.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
27 ;; This file provides the drop part only. Currently supported protocols |
53949
7edbce1dd20a
* x-dnd.el: Mention support for Motif in commentary.
Jan Djärv <jan.h.d@swipnet.se>
parents:
53913
diff
changeset
|
28 ;; are XDND, Motif and the old KDE 1.x protocol. |
53789
7efe8089eadf
* x-dnd.el: New file for drag and drop.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
29 |
7efe8089eadf
* x-dnd.el: New file for drag and drop.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
30 ;;; Code: |
7efe8089eadf
* x-dnd.el: New file for drag and drop.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
31 |
61476 | 32 (require 'dnd) |
53789
7efe8089eadf
* x-dnd.el: New file for drag and drop.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
33 |
61476 | 34 ;;; Customizable variables |
53789
7efe8089eadf
* x-dnd.el: New file for drag and drop.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
35 (defcustom x-dnd-test-function 'x-dnd-default-test-function |
7efe8089eadf
* x-dnd.el: New file for drag and drop.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
36 "The function drag and drop uses to determine if to accept or reject a drop. |
102285
ece8e00c3763
* x-dnd.el (x-dnd-test-function, x-dnd-get-state-cons-for-frame)
Juanma Barranquero <lekktu@gmail.com>
parents:
100908
diff
changeset
|
37 The function takes three arguments, WINDOW, ACTION and TYPES. |
53789
7efe8089eadf
* x-dnd.el: New file for drag and drop.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
38 WINDOW is where the mouse is when the function is called. WINDOW may be a |
7efe8089eadf
* x-dnd.el: New file for drag and drop.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
39 frame if the mouse isn't over a real window (i.e. menu bar, tool bar or |
7efe8089eadf
* x-dnd.el: New file for drag and drop.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
40 scroll bar). ACTION is the suggested action from the drag and drop source, |
102285
ece8e00c3763
* x-dnd.el (x-dnd-test-function, x-dnd-get-state-cons-for-frame)
Juanma Barranquero <lekktu@gmail.com>
parents:
100908
diff
changeset
|
41 one of the symbols move, copy, link or ask. TYPES is a list of available |
ece8e00c3763
* x-dnd.el (x-dnd-test-function, x-dnd-get-state-cons-for-frame)
Juanma Barranquero <lekktu@gmail.com>
parents:
100908
diff
changeset
|
42 types for the drop. |
53789
7efe8089eadf
* x-dnd.el: New file for drag and drop.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
43 |
7efe8089eadf
* x-dnd.el: New file for drag and drop.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
44 The function shall return nil to reject the drop or a cons with two values, |
7efe8089eadf
* x-dnd.el: New file for drag and drop.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
45 the wanted action as car and the wanted type as cdr. The wanted action |
7efe8089eadf
* x-dnd.el: New file for drag and drop.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
46 can be copy, move, link, ask or private. |
7efe8089eadf
* x-dnd.el: New file for drag and drop.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
47 The default value for this variable is `x-dnd-default-test-function'." |
59996
aac0a33f5772
Change release version from 21.4 to 22.1 throughout.
Kim F. Storm <storm@cua.dk>
parents:
59932
diff
changeset
|
48 :version "22.1" |
53789
7efe8089eadf
* x-dnd.el: New file for drag and drop.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
49 :type 'symbol |
7efe8089eadf
* x-dnd.el: New file for drag and drop.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
50 :group 'x) |
7efe8089eadf
* x-dnd.el: New file for drag and drop.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
51 |
7efe8089eadf
* x-dnd.el: New file for drag and drop.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
52 |
7efe8089eadf
* x-dnd.el: New file for drag and drop.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
53 |
7efe8089eadf
* x-dnd.el: New file for drag and drop.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
54 (defcustom x-dnd-types-alist |
105765
db5e4a5897ec
* textmodes/tex-mode.el (tex-dvi-view-command)
Dan Nicolaescu <dann@ics.uci.edu>
parents:
104823
diff
changeset
|
55 `( |
db5e4a5897ec
* textmodes/tex-mode.el (tex-dvi-view-command)
Dan Nicolaescu <dann@ics.uci.edu>
parents:
104823
diff
changeset
|
56 (,(purecopy "text/uri-list") . x-dnd-handle-uri-list) |
db5e4a5897ec
* textmodes/tex-mode.el (tex-dvi-view-command)
Dan Nicolaescu <dann@ics.uci.edu>
parents:
104823
diff
changeset
|
57 (,(purecopy "text/x-moz-url") . x-dnd-handle-moz-url) |
db5e4a5897ec
* textmodes/tex-mode.el (tex-dvi-view-command)
Dan Nicolaescu <dann@ics.uci.edu>
parents:
104823
diff
changeset
|
58 (,(purecopy "_NETSCAPE_URL") . x-dnd-handle-uri-list) |
db5e4a5897ec
* textmodes/tex-mode.el (tex-dvi-view-command)
Dan Nicolaescu <dann@ics.uci.edu>
parents:
104823
diff
changeset
|
59 (,(purecopy "FILE_NAME") . x-dnd-handle-file-name) |
db5e4a5897ec
* textmodes/tex-mode.el (tex-dvi-view-command)
Dan Nicolaescu <dann@ics.uci.edu>
parents:
104823
diff
changeset
|
60 (,(purecopy "UTF8_STRING") . x-dnd-insert-utf8-text) |
db5e4a5897ec
* textmodes/tex-mode.el (tex-dvi-view-command)
Dan Nicolaescu <dann@ics.uci.edu>
parents:
104823
diff
changeset
|
61 (,(purecopy "text/plain;charset=UTF-8") . x-dnd-insert-utf8-text) |
db5e4a5897ec
* textmodes/tex-mode.el (tex-dvi-view-command)
Dan Nicolaescu <dann@ics.uci.edu>
parents:
104823
diff
changeset
|
62 (,(purecopy "text/plain;charset=utf-8") . x-dnd-insert-utf8-text) |
db5e4a5897ec
* textmodes/tex-mode.el (tex-dvi-view-command)
Dan Nicolaescu <dann@ics.uci.edu>
parents:
104823
diff
changeset
|
63 (,(purecopy "text/unicode") . x-dnd-insert-utf16-text) |
db5e4a5897ec
* textmodes/tex-mode.el (tex-dvi-view-command)
Dan Nicolaescu <dann@ics.uci.edu>
parents:
104823
diff
changeset
|
64 (,(purecopy "text/plain") . dnd-insert-text) |
db5e4a5897ec
* textmodes/tex-mode.el (tex-dvi-view-command)
Dan Nicolaescu <dann@ics.uci.edu>
parents:
104823
diff
changeset
|
65 (,(purecopy "COMPOUND_TEXT") . x-dnd-insert-ctext) |
db5e4a5897ec
* textmodes/tex-mode.el (tex-dvi-view-command)
Dan Nicolaescu <dann@ics.uci.edu>
parents:
104823
diff
changeset
|
66 (,(purecopy "STRING") . dnd-insert-text) |
db5e4a5897ec
* textmodes/tex-mode.el (tex-dvi-view-command)
Dan Nicolaescu <dann@ics.uci.edu>
parents:
104823
diff
changeset
|
67 (,(purecopy "TEXT") . dnd-insert-text) |
53789
7efe8089eadf
* x-dnd.el: New file for drag and drop.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
68 ) |
7efe8089eadf
* x-dnd.el: New file for drag and drop.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
69 "Which function to call to handle a drop of that type. |
7efe8089eadf
* x-dnd.el: New file for drag and drop.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
70 If the type for the drop is not present, or the function is nil, |
7efe8089eadf
* x-dnd.el: New file for drag and drop.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
71 the drop is rejected. The function takes three arguments, WINDOW, ACTION |
75140
6674b79afd5e
(x-dnd-types-alist): Fix typo in docstring.
Juanma Barranquero <lekktu@gmail.com>
parents:
72485
diff
changeset
|
72 and DATA. WINDOW is where the drop occurred, ACTION is the action for |
53789
7efe8089eadf
* x-dnd.el: New file for drag and drop.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
73 this drop (copy, move, link, private or ask) as determined by a previous |
7efe8089eadf
* x-dnd.el: New file for drag and drop.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
74 call to `x-dnd-test-function'. DATA is the drop data. |
102285
ece8e00c3763
* x-dnd.el (x-dnd-test-function, x-dnd-get-state-cons-for-frame)
Juanma Barranquero <lekktu@gmail.com>
parents:
100908
diff
changeset
|
75 The function shall return the action used (copy, move, link or private) |
ece8e00c3763
* x-dnd.el (x-dnd-test-function, x-dnd-get-state-cons-for-frame)
Juanma Barranquero <lekktu@gmail.com>
parents:
100908
diff
changeset
|
76 if drop is successful, nil if not." |
59996
aac0a33f5772
Change release version from 21.4 to 22.1 throughout.
Kim F. Storm <storm@cua.dk>
parents:
59932
diff
changeset
|
77 :version "22.1" |
53789
7efe8089eadf
* x-dnd.el: New file for drag and drop.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
78 :type 'alist |
7efe8089eadf
* x-dnd.el: New file for drag and drop.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
79 :group 'x) |
7efe8089eadf
* x-dnd.el: New file for drag and drop.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
80 |
56852
4504840779eb
* x-dnd.el (x-dnd-protocol-alist): Document update.
Jan Djärv <jan.h.d@swipnet.se>
parents:
54986
diff
changeset
|
81 (defcustom x-dnd-known-types |
105870
26baacb565b0
* textmodes/tex-mode.el (tex-alt-dvi-print-command)
Dan Nicolaescu <dann@ics.uci.edu>
parents:
105765
diff
changeset
|
82 (mapcar 'purecopy |
53789
7efe8089eadf
* x-dnd.el: New file for drag and drop.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
83 '("text/uri-list" |
7efe8089eadf
* x-dnd.el: New file for drag and drop.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
84 "text/x-moz-url" |
53913
e83b3b3941cf
x-dnd.el: Add COMPOUND_TEXT, handle FILE_NAME correctly, add Motif (CDE)
Jan Djärv <jan.h.d@swipnet.se>
parents:
53823
diff
changeset
|
85 "_NETSCAPE_URL" |
53789
7efe8089eadf
* x-dnd.el: New file for drag and drop.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
86 "FILE_NAME" |
7efe8089eadf
* x-dnd.el: New file for drag and drop.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
87 "UTF8_STRING" |
7efe8089eadf
* x-dnd.el: New file for drag and drop.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
88 "text/plain;charset=UTF-8" |
7efe8089eadf
* x-dnd.el: New file for drag and drop.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
89 "text/plain;charset=utf-8" |
7efe8089eadf
* x-dnd.el: New file for drag and drop.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
90 "text/unicode" |
7efe8089eadf
* x-dnd.el: New file for drag and drop.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
91 "text/plain" |
53913
e83b3b3941cf
x-dnd.el: Add COMPOUND_TEXT, handle FILE_NAME correctly, add Motif (CDE)
Jan Djärv <jan.h.d@swipnet.se>
parents:
53823
diff
changeset
|
92 "COMPOUND_TEXT" |
53789
7efe8089eadf
* x-dnd.el: New file for drag and drop.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
93 "STRING" |
7efe8089eadf
* x-dnd.el: New file for drag and drop.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
94 "TEXT" |
105870
26baacb565b0
* textmodes/tex-mode.el (tex-alt-dvi-print-command)
Dan Nicolaescu <dann@ics.uci.edu>
parents:
105765
diff
changeset
|
95 )) |
53789
7efe8089eadf
* x-dnd.el: New file for drag and drop.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
96 "The types accepted by default for dropped data. |
56852
4504840779eb
* x-dnd.el (x-dnd-protocol-alist): Document update.
Jan Djärv <jan.h.d@swipnet.se>
parents:
54986
diff
changeset
|
97 The types are chosen in the order they appear in the list." |
59996
aac0a33f5772
Change release version from 21.4 to 22.1 throughout.
Kim F. Storm <storm@cua.dk>
parents:
59932
diff
changeset
|
98 :version "22.1" |
56852
4504840779eb
* x-dnd.el (x-dnd-protocol-alist): Document update.
Jan Djärv <jan.h.d@swipnet.se>
parents:
54986
diff
changeset
|
99 :type '(repeat string) |
4504840779eb
* x-dnd.el (x-dnd-protocol-alist): Document update.
Jan Djärv <jan.h.d@swipnet.se>
parents:
54986
diff
changeset
|
100 :group 'x |
4504840779eb
* x-dnd.el (x-dnd-protocol-alist): Document update.
Jan Djärv <jan.h.d@swipnet.se>
parents:
54986
diff
changeset
|
101 ) |
4504840779eb
* x-dnd.el (x-dnd-protocol-alist): Document update.
Jan Djärv <jan.h.d@swipnet.se>
parents:
54986
diff
changeset
|
102 |
4504840779eb
* x-dnd.el (x-dnd-protocol-alist): Document update.
Jan Djärv <jan.h.d@swipnet.se>
parents:
54986
diff
changeset
|
103 ;; Internal variables |
53789
7efe8089eadf
* x-dnd.el: New file for drag and drop.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
104 |
7efe8089eadf
* x-dnd.el: New file for drag and drop.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
105 (defvar x-dnd-current-state nil |
7efe8089eadf
* x-dnd.el: New file for drag and drop.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
106 "The current state for a drop. |
7efe8089eadf
* x-dnd.el: New file for drag and drop.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
107 This is an alist with one entry for each display. The value for each display |
7efe8089eadf
* x-dnd.el: New file for drag and drop.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
108 is a vector that contains the state for drag and drop for that display. |
59996
aac0a33f5772
Change release version from 21.4 to 22.1 throughout.
Kim F. Storm <storm@cua.dk>
parents:
59932
diff
changeset
|
109 Elements in the vector are: |
53789
7efe8089eadf
* x-dnd.el: New file for drag and drop.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
110 Last buffer drag was in, |
7efe8089eadf
* x-dnd.el: New file for drag and drop.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
111 last window drag was in, |
59996
aac0a33f5772
Change release version from 21.4 to 22.1 throughout.
Kim F. Storm <storm@cua.dk>
parents:
59932
diff
changeset
|
112 types available for drop, |
53789
7efe8089eadf
* x-dnd.el: New file for drag and drop.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
113 the action suggested by the source, |
7efe8089eadf
* x-dnd.el: New file for drag and drop.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
114 the type we want for the drop, |
53913
e83b3b3941cf
x-dnd.el: Add COMPOUND_TEXT, handle FILE_NAME correctly, add Motif (CDE)
Jan Djärv <jan.h.d@swipnet.se>
parents:
53823
diff
changeset
|
115 the action we want for the drop, |
e83b3b3941cf
x-dnd.el: Add COMPOUND_TEXT, handle FILE_NAME correctly, add Motif (CDE)
Jan Djärv <jan.h.d@swipnet.se>
parents:
53823
diff
changeset
|
116 any protocol specific data.") |
53789
7efe8089eadf
* x-dnd.el: New file for drag and drop.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
117 |
53913
e83b3b3941cf
x-dnd.el: Add COMPOUND_TEXT, handle FILE_NAME correctly, add Motif (CDE)
Jan Djärv <jan.h.d@swipnet.se>
parents:
53823
diff
changeset
|
118 (defvar x-dnd-empty-state [nil nil nil nil nil nil nil]) |
53789
7efe8089eadf
* x-dnd.el: New file for drag and drop.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
119 |
86325
613267d53431
(x-register-dnd-atom, x-get-atom-name, x-send-client-message):
Juanma Barranquero <lekktu@gmail.com>
parents:
83648
diff
changeset
|
120 (declare-function x-register-dnd-atom "xselect.c") |
53789
7efe8089eadf
* x-dnd.el: New file for drag and drop.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
121 |
7efe8089eadf
* x-dnd.el: New file for drag and drop.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
122 (defun x-dnd-init-frame (&optional frame) |
7efe8089eadf
* x-dnd.el: New file for drag and drop.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
123 "Setup drag and drop for FRAME (i.e. create appropriate properties)." |
83040
b0da1c792c48
Don't try to init X drag and drop on a termcap frame.
Karoly Lorentey <lorentey@elte.hu>
parents:
53949
diff
changeset
|
124 (when (eq 'x (window-system frame)) |
83541 | 125 (x-register-dnd-atom "DndProtocol" frame) |
126 (x-register-dnd-atom "_MOTIF_DRAG_AND_DROP_MESSAGE" frame) | |
127 (x-register-dnd-atom "XdndEnter" frame) | |
128 (x-register-dnd-atom "XdndPosition" frame) | |
129 (x-register-dnd-atom "XdndLeave" frame) | |
130 (x-register-dnd-atom "XdndDrop" frame) | |
83040
b0da1c792c48
Don't try to init X drag and drop on a termcap frame.
Karoly Lorentey <lorentey@elte.hu>
parents:
53949
diff
changeset
|
131 (x-dnd-init-xdnd-for-frame frame) |
b0da1c792c48
Don't try to init X drag and drop on a termcap frame.
Karoly Lorentey <lorentey@elte.hu>
parents:
53949
diff
changeset
|
132 (x-dnd-init-motif-for-frame frame))) |
53789
7efe8089eadf
* x-dnd.el: New file for drag and drop.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
133 |
7efe8089eadf
* x-dnd.el: New file for drag and drop.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
134 (defun x-dnd-get-state-cons-for-frame (frame-or-window) |
102285
ece8e00c3763
* x-dnd.el (x-dnd-test-function, x-dnd-get-state-cons-for-frame)
Juanma Barranquero <lekktu@gmail.com>
parents:
100908
diff
changeset
|
135 "Return the entry in `x-dnd-current-state' for a frame or window." |
53789
7efe8089eadf
* x-dnd.el: New file for drag and drop.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
136 (let* ((frame (if (framep frame-or-window) frame-or-window |
7efe8089eadf
* x-dnd.el: New file for drag and drop.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
137 (window-frame frame-or-window))) |
7efe8089eadf
* x-dnd.el: New file for drag and drop.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
138 (display (frame-parameter frame 'display))) |
7efe8089eadf
* x-dnd.el: New file for drag and drop.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
139 (if (not (assoc display x-dnd-current-state)) |
53913
e83b3b3941cf
x-dnd.el: Add COMPOUND_TEXT, handle FILE_NAME correctly, add Motif (CDE)
Jan Djärv <jan.h.d@swipnet.se>
parents:
53823
diff
changeset
|
140 (push (cons display (copy-sequence x-dnd-empty-state)) |
e83b3b3941cf
x-dnd.el: Add COMPOUND_TEXT, handle FILE_NAME correctly, add Motif (CDE)
Jan Djärv <jan.h.d@swipnet.se>
parents:
53823
diff
changeset
|
141 x-dnd-current-state)) |
53789
7efe8089eadf
* x-dnd.el: New file for drag and drop.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
142 (assoc display x-dnd-current-state))) |
7efe8089eadf
* x-dnd.el: New file for drag and drop.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
143 |
7efe8089eadf
* x-dnd.el: New file for drag and drop.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
144 (defun x-dnd-get-state-for-frame (frame-or-window) |
102285
ece8e00c3763
* x-dnd.el (x-dnd-test-function, x-dnd-get-state-cons-for-frame)
Juanma Barranquero <lekktu@gmail.com>
parents:
100908
diff
changeset
|
145 "Return the state in `x-dnd-current-state' for a frame or window." |
53789
7efe8089eadf
* x-dnd.el: New file for drag and drop.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
146 (cdr (x-dnd-get-state-cons-for-frame frame-or-window))) |
7efe8089eadf
* x-dnd.el: New file for drag and drop.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
147 |
7efe8089eadf
* x-dnd.el: New file for drag and drop.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
148 (defun x-dnd-default-test-function (window action types) |
7efe8089eadf
* x-dnd.el: New file for drag and drop.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
149 "The default test function for drag and drop. |
102285
ece8e00c3763
* x-dnd.el (x-dnd-test-function, x-dnd-get-state-cons-for-frame)
Juanma Barranquero <lekktu@gmail.com>
parents:
100908
diff
changeset
|
150 WINDOW is where the mouse is when this function is called. It may be |
ece8e00c3763
* x-dnd.el (x-dnd-test-function, x-dnd-get-state-cons-for-frame)
Juanma Barranquero <lekktu@gmail.com>
parents:
100908
diff
changeset
|
151 a frame if the mouse is over the menu bar, scroll bar or tool bar. |
53789
7efe8089eadf
* x-dnd.el: New file for drag and drop.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
152 ACTION is the suggested action from the source, and TYPES are the |
7efe8089eadf
* x-dnd.el: New file for drag and drop.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
153 types the drop data can have. This function only accepts drops with |
7efe8089eadf
* x-dnd.el: New file for drag and drop.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
154 types in `x-dnd-known-types'. It always returns the action private." |
7efe8089eadf
* x-dnd.el: New file for drag and drop.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
155 (let ((type (x-dnd-choose-type types))) |
7efe8089eadf
* x-dnd.el: New file for drag and drop.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
156 (when type (cons 'private type)))) |
7efe8089eadf
* x-dnd.el: New file for drag and drop.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
157 |
7efe8089eadf
* x-dnd.el: New file for drag and drop.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
158 |
7efe8089eadf
* x-dnd.el: New file for drag and drop.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
159 (defun x-dnd-current-type (frame-or-window) |
7efe8089eadf
* x-dnd.el: New file for drag and drop.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
160 "Return the type we want the DND data to be in for the current drop. |
7efe8089eadf
* x-dnd.el: New file for drag and drop.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
161 FRAME-OR-WINDOW is the frame or window that the mouse is over." |
7efe8089eadf
* x-dnd.el: New file for drag and drop.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
162 (aref (x-dnd-get-state-for-frame frame-or-window) 4)) |
7efe8089eadf
* x-dnd.el: New file for drag and drop.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
163 |
7efe8089eadf
* x-dnd.el: New file for drag and drop.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
164 (defun x-dnd-forget-drop (frame-or-window) |
7efe8089eadf
* x-dnd.el: New file for drag and drop.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
165 "Remove all state for the last drop. |
7efe8089eadf
* x-dnd.el: New file for drag and drop.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
166 FRAME-OR-WINDOW is the frame or window that the mouse is over." |
53913
e83b3b3941cf
x-dnd.el: Add COMPOUND_TEXT, handle FILE_NAME correctly, add Motif (CDE)
Jan Djärv <jan.h.d@swipnet.se>
parents:
53823
diff
changeset
|
167 (setcdr (x-dnd-get-state-cons-for-frame frame-or-window) |
e83b3b3941cf
x-dnd.el: Add COMPOUND_TEXT, handle FILE_NAME correctly, add Motif (CDE)
Jan Djärv <jan.h.d@swipnet.se>
parents:
53823
diff
changeset
|
168 (copy-sequence x-dnd-empty-state))) |
53789
7efe8089eadf
* x-dnd.el: New file for drag and drop.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
169 |
7efe8089eadf
* x-dnd.el: New file for drag and drop.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
170 (defun x-dnd-maybe-call-test-function (window action) |
7efe8089eadf
* x-dnd.el: New file for drag and drop.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
171 "Call `x-dnd-test-function' if something has changed. |
7efe8089eadf
* x-dnd.el: New file for drag and drop.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
172 WINDOW is the window the mouse is over. ACTION is the suggested |
7efe8089eadf
* x-dnd.el: New file for drag and drop.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
173 action from the source. If nothing has changed, return the last |
7efe8089eadf
* x-dnd.el: New file for drag and drop.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
174 action and type we got from `x-dnd-test-function'." |
81390
fe478726dca2
(x-dnd-maybe-call-test-function, x-dnd-save-state, x-dnd-drop-data):
Juanma Barranquero <lekktu@gmail.com>
parents:
75347
diff
changeset
|
175 (let ((buffer (when (window-live-p window) |
53789
7efe8089eadf
* x-dnd.el: New file for drag and drop.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
176 (window-buffer window))) |
7efe8089eadf
* x-dnd.el: New file for drag and drop.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
177 (current-state (x-dnd-get-state-for-frame window))) |
105994
009383a57ce8
* x-dnd.el (x-dnd-maybe-call-test-function):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
105870
diff
changeset
|
178 (unless (and (equal buffer (aref current-state 0)) |
009383a57ce8
* x-dnd.el (x-dnd-maybe-call-test-function):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
105870
diff
changeset
|
179 (equal window (aref current-state 1)) |
009383a57ce8
* x-dnd.el (x-dnd-maybe-call-test-function):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
105870
diff
changeset
|
180 (equal action (aref current-state 3))) |
009383a57ce8
* x-dnd.el (x-dnd-maybe-call-test-function):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
105870
diff
changeset
|
181 (save-current-buffer |
53789
7efe8089eadf
* x-dnd.el: New file for drag and drop.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
182 (when buffer (set-buffer buffer)) |
7efe8089eadf
* x-dnd.el: New file for drag and drop.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
183 (let* ((action-type (funcall x-dnd-test-function |
7efe8089eadf
* x-dnd.el: New file for drag and drop.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
184 window |
7efe8089eadf
* x-dnd.el: New file for drag and drop.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
185 action |
7efe8089eadf
* x-dnd.el: New file for drag and drop.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
186 (aref current-state 2))) |
7efe8089eadf
* x-dnd.el: New file for drag and drop.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
187 (handler (cdr (assoc (cdr action-type) x-dnd-types-alist)))) |
7efe8089eadf
* x-dnd.el: New file for drag and drop.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
188 ;; Ignore action-type if we have no handler. |
7efe8089eadf
* x-dnd.el: New file for drag and drop.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
189 (setq current-state |
59996
aac0a33f5772
Change release version from 21.4 to 22.1 throughout.
Kim F. Storm <storm@cua.dk>
parents:
59932
diff
changeset
|
190 (x-dnd-save-state window |
53789
7efe8089eadf
* x-dnd.el: New file for drag and drop.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
191 action |
7efe8089eadf
* x-dnd.el: New file for drag and drop.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
192 (when handler action-type))))))) |
7efe8089eadf
* x-dnd.el: New file for drag and drop.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
193 (let ((current-state (x-dnd-get-state-for-frame window))) |
7efe8089eadf
* x-dnd.el: New file for drag and drop.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
194 (cons (aref current-state 5) |
7efe8089eadf
* x-dnd.el: New file for drag and drop.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
195 (aref current-state 4)))) |
7efe8089eadf
* x-dnd.el: New file for drag and drop.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
196 |
53913
e83b3b3941cf
x-dnd.el: Add COMPOUND_TEXT, handle FILE_NAME correctly, add Motif (CDE)
Jan Djärv <jan.h.d@swipnet.se>
parents:
53823
diff
changeset
|
197 (defun x-dnd-save-state (window action action-type &optional types extra-data) |
53789
7efe8089eadf
* x-dnd.el: New file for drag and drop.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
198 "Save the state of the current drag and drop. |
7efe8089eadf
* x-dnd.el: New file for drag and drop.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
199 WINDOW is the window the mouse is over. ACTION is the action suggested |
7efe8089eadf
* x-dnd.el: New file for drag and drop.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
200 by the source. ACTION-TYPE is the result of calling `x-dnd-test-function'. |
53913
e83b3b3941cf
x-dnd.el: Add COMPOUND_TEXT, handle FILE_NAME correctly, add Motif (CDE)
Jan Djärv <jan.h.d@swipnet.se>
parents:
53823
diff
changeset
|
201 If given, TYPES are the types for the drop data that the source supports. |
e83b3b3941cf
x-dnd.el: Add COMPOUND_TEXT, handle FILE_NAME correctly, add Motif (CDE)
Jan Djärv <jan.h.d@swipnet.se>
parents:
53823
diff
changeset
|
202 EXTRA-DATA is data needed for a specific protocol." |
53789
7efe8089eadf
* x-dnd.el: New file for drag and drop.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
203 (let ((current-state (x-dnd-get-state-for-frame window))) |
7efe8089eadf
* x-dnd.el: New file for drag and drop.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
204 (aset current-state 5 (car action-type)) |
7efe8089eadf
* x-dnd.el: New file for drag and drop.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
205 (aset current-state 4 (cdr action-type)) |
7efe8089eadf
* x-dnd.el: New file for drag and drop.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
206 (aset current-state 3 action) |
53913
e83b3b3941cf
x-dnd.el: Add COMPOUND_TEXT, handle FILE_NAME correctly, add Motif (CDE)
Jan Djärv <jan.h.d@swipnet.se>
parents:
53823
diff
changeset
|
207 (when types (aset current-state 2 types)) |
e83b3b3941cf
x-dnd.el: Add COMPOUND_TEXT, handle FILE_NAME correctly, add Motif (CDE)
Jan Djärv <jan.h.d@swipnet.se>
parents:
53823
diff
changeset
|
208 (when extra-data (aset current-state 6 extra-data)) |
53789
7efe8089eadf
* x-dnd.el: New file for drag and drop.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
209 (aset current-state 1 window) |
81390
fe478726dca2
(x-dnd-maybe-call-test-function, x-dnd-save-state, x-dnd-drop-data):
Juanma Barranquero <lekktu@gmail.com>
parents:
75347
diff
changeset
|
210 (aset current-state 0 (and (window-live-p window) (window-buffer window))) |
53789
7efe8089eadf
* x-dnd.el: New file for drag and drop.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
211 (setcdr (x-dnd-get-state-cons-for-frame window) current-state))) |
7efe8089eadf
* x-dnd.el: New file for drag and drop.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
212 |
7efe8089eadf
* x-dnd.el: New file for drag and drop.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
213 |
7efe8089eadf
* x-dnd.el: New file for drag and drop.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
214 (defun x-dnd-handle-moz-url (window action data) |
7efe8089eadf
* x-dnd.el: New file for drag and drop.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
215 "Handle one item of type text/x-moz-url. |
7efe8089eadf
* x-dnd.el: New file for drag and drop.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
216 WINDOW is the window where the drop happened. ACTION is ignored. |
102285
ece8e00c3763
* x-dnd.el (x-dnd-test-function, x-dnd-get-state-cons-for-frame)
Juanma Barranquero <lekktu@gmail.com>
parents:
100908
diff
changeset
|
217 DATA is the moz-url, which is formatted as two strings separated by \\r\\n. |
53789
7efe8089eadf
* x-dnd.el: New file for drag and drop.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
218 The first string is the URL, the second string is the title of that URL. |
7efe8089eadf
* x-dnd.el: New file for drag and drop.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
219 DATA is encoded in utf-16. Decode the URL and call `x-dnd-handle-uri-list'." |
54682
bd0296e87c16
* x-dnd.el (x-dnd-handle-moz-url, x-dnd-insert-utf16-text): Use
Jan Djärv <jan.h.d@swipnet.se>
parents:
53949
diff
changeset
|
220 ;; Mozilla and applications based on it (Galeon for example) uses |
bd0296e87c16
* x-dnd.el (x-dnd-handle-moz-url, x-dnd-insert-utf16-text): Use
Jan Djärv <jan.h.d@swipnet.se>
parents:
53949
diff
changeset
|
221 ;; text/unicode, but it is impossible to tell if it is le or be. Use what |
bd0296e87c16
* x-dnd.el (x-dnd-handle-moz-url, x-dnd-insert-utf16-text): Use
Jan Djärv <jan.h.d@swipnet.se>
parents:
53949
diff
changeset
|
222 ;; the machine Emacs runs on use. This looses if dropping between machines |
bd0296e87c16
* x-dnd.el (x-dnd-handle-moz-url, x-dnd-insert-utf16-text): Use
Jan Djärv <jan.h.d@swipnet.se>
parents:
53949
diff
changeset
|
223 ;; with different endian, but it is the best we can do. |
bd0296e87c16
* x-dnd.el (x-dnd-handle-moz-url, x-dnd-insert-utf16-text): Use
Jan Djärv <jan.h.d@swipnet.se>
parents:
53949
diff
changeset
|
224 (let* ((coding (if (eq (byteorder) ?B) 'utf-16be 'utf-16le)) |
bd0296e87c16
* x-dnd.el (x-dnd-handle-moz-url, x-dnd-insert-utf16-text): Use
Jan Djärv <jan.h.d@swipnet.se>
parents:
53949
diff
changeset
|
225 (string (decode-coding-string data coding)) |
53789
7efe8089eadf
* x-dnd.el: New file for drag and drop.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
226 (strings (split-string string "[\r\n]" t)) |
7efe8089eadf
* x-dnd.el: New file for drag and drop.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
227 ;; Can one drop more than one moz-url ?? Assume not. |
7efe8089eadf
* x-dnd.el: New file for drag and drop.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
228 (url (car strings)) |
7efe8089eadf
* x-dnd.el: New file for drag and drop.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
229 (title (car (cdr strings)))) |
7efe8089eadf
* x-dnd.el: New file for drag and drop.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
230 (x-dnd-handle-uri-list window action url))) |
7efe8089eadf
* x-dnd.el: New file for drag and drop.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
231 |
7efe8089eadf
* x-dnd.el: New file for drag and drop.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
232 (defun x-dnd-insert-utf8-text (window action text) |
7efe8089eadf
* x-dnd.el: New file for drag and drop.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
233 "Decode the UTF-8 text and insert it at point. |
7efe8089eadf
* x-dnd.el: New file for drag and drop.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
234 TEXT is the text as a string, WINDOW is the window where the drop happened." |
61476 | 235 (dnd-insert-text window action (decode-coding-string text 'utf-8))) |
53789
7efe8089eadf
* x-dnd.el: New file for drag and drop.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
236 |
7efe8089eadf
* x-dnd.el: New file for drag and drop.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
237 (defun x-dnd-insert-utf16-text (window action text) |
7efe8089eadf
* x-dnd.el: New file for drag and drop.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
238 "Decode the UTF-16 text and insert it at point. |
7efe8089eadf
* x-dnd.el: New file for drag and drop.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
239 TEXT is the text as a string, WINDOW is the window where the drop happened." |
54682
bd0296e87c16
* x-dnd.el (x-dnd-handle-moz-url, x-dnd-insert-utf16-text): Use
Jan Djärv <jan.h.d@swipnet.se>
parents:
53949
diff
changeset
|
240 ;; See comment in x-dnd-handle-moz-url about coding. |
bd0296e87c16
* x-dnd.el (x-dnd-handle-moz-url, x-dnd-insert-utf16-text): Use
Jan Djärv <jan.h.d@swipnet.se>
parents:
53949
diff
changeset
|
241 (let ((coding (if (eq (byteorder) ?B) 'utf-16be 'utf-16le))) |
61476 | 242 (dnd-insert-text window action (decode-coding-string text coding)))) |
53789
7efe8089eadf
* x-dnd.el: New file for drag and drop.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
243 |
53913
e83b3b3941cf
x-dnd.el: Add COMPOUND_TEXT, handle FILE_NAME correctly, add Motif (CDE)
Jan Djärv <jan.h.d@swipnet.se>
parents:
53823
diff
changeset
|
244 (defun x-dnd-insert-ctext (window action text) |
e83b3b3941cf
x-dnd.el: Add COMPOUND_TEXT, handle FILE_NAME correctly, add Motif (CDE)
Jan Djärv <jan.h.d@swipnet.se>
parents:
53823
diff
changeset
|
245 "Decode the compound text and insert it at point. |
e83b3b3941cf
x-dnd.el: Add COMPOUND_TEXT, handle FILE_NAME correctly, add Motif (CDE)
Jan Djärv <jan.h.d@swipnet.se>
parents:
53823
diff
changeset
|
246 TEXT is the text as a string, WINDOW is the window where the drop happened." |
61476 | 247 (dnd-insert-text window action |
248 (decode-coding-string text | |
249 'compound-text-with-extensions))) | |
53789
7efe8089eadf
* x-dnd.el: New file for drag and drop.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
250 |
7efe8089eadf
* x-dnd.el: New file for drag and drop.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
251 (defun x-dnd-handle-uri-list (window action string) |
61476 | 252 "Split an uri-list into separate URIs and call `dnd-handle-one-url'. |
53789
7efe8089eadf
* x-dnd.el: New file for drag and drop.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
253 WINDOW is the window where the drop happened. |
102285
ece8e00c3763
* x-dnd.el (x-dnd-test-function, x-dnd-get-state-cons-for-frame)
Juanma Barranquero <lekktu@gmail.com>
parents:
100908
diff
changeset
|
254 STRING is the uri-list as a string. The URIs are separated by \\r\\n." |
53789
7efe8089eadf
* x-dnd.el: New file for drag and drop.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
255 (let ((uri-list (split-string string "[\0\r\n]" t)) |
7efe8089eadf
* x-dnd.el: New file for drag and drop.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
256 retval) |
7efe8089eadf
* x-dnd.el: New file for drag and drop.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
257 (dolist (bf uri-list) |
102285
ece8e00c3763
* x-dnd.el (x-dnd-test-function, x-dnd-get-state-cons-for-frame)
Juanma Barranquero <lekktu@gmail.com>
parents:
100908
diff
changeset
|
258 ;; If one URL is handled, treat as if the whole drop succeeded. |
61476 | 259 (let ((did-action (dnd-handle-one-url window action bf))) |
53789
7efe8089eadf
* x-dnd.el: New file for drag and drop.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
260 (when did-action (setq retval did-action)))) |
7efe8089eadf
* x-dnd.el: New file for drag and drop.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
261 retval)) |
7efe8089eadf
* x-dnd.el: New file for drag and drop.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
262 |
53913
e83b3b3941cf
x-dnd.el: Add COMPOUND_TEXT, handle FILE_NAME correctly, add Motif (CDE)
Jan Djärv <jan.h.d@swipnet.se>
parents:
53823
diff
changeset
|
263 (defun x-dnd-handle-file-name (window action string) |
70761
b1742b0066f2
(x-dnd-handle-file-name): Encode and escape file names
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
68651
diff
changeset
|
264 "Convert file names to URLs and call `dnd-handle-one-url'. |
53913
e83b3b3941cf
x-dnd.el: Add COMPOUND_TEXT, handle FILE_NAME correctly, add Motif (CDE)
Jan Djärv <jan.h.d@swipnet.se>
parents:
53823
diff
changeset
|
265 WINDOW is the window where the drop happened. |
e83b3b3941cf
x-dnd.el: Add COMPOUND_TEXT, handle FILE_NAME correctly, add Motif (CDE)
Jan Djärv <jan.h.d@swipnet.se>
parents:
53823
diff
changeset
|
266 STRING is the file names as a string, separated by nulls." |
e83b3b3941cf
x-dnd.el: Add COMPOUND_TEXT, handle FILE_NAME correctly, add Motif (CDE)
Jan Djärv <jan.h.d@swipnet.se>
parents:
53823
diff
changeset
|
267 (let ((uri-list (split-string string "[\0\r\n]" t)) |
104823
68150c643e2e
Use default-value rather than default-enable-multibyte-characters.
Glenn Morris <rgm@gnu.org>
parents:
102285
diff
changeset
|
268 (coding (and (default-value 'enable-multibyte-characters) |
70761
b1742b0066f2
(x-dnd-handle-file-name): Encode and escape file names
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
68651
diff
changeset
|
269 (or file-name-coding-system |
b1742b0066f2
(x-dnd-handle-file-name): Encode and escape file names
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
68651
diff
changeset
|
270 default-file-name-coding-system))) |
53913
e83b3b3941cf
x-dnd.el: Add COMPOUND_TEXT, handle FILE_NAME correctly, add Motif (CDE)
Jan Djärv <jan.h.d@swipnet.se>
parents:
53823
diff
changeset
|
271 retval) |
e83b3b3941cf
x-dnd.el: Add COMPOUND_TEXT, handle FILE_NAME correctly, add Motif (CDE)
Jan Djärv <jan.h.d@swipnet.se>
parents:
53823
diff
changeset
|
272 (dolist (bf uri-list) |
102285
ece8e00c3763
* x-dnd.el (x-dnd-test-function, x-dnd-get-state-cons-for-frame)
Juanma Barranquero <lekktu@gmail.com>
parents:
100908
diff
changeset
|
273 ;; If one URL is handled, treat as if the whole drop succeeded. |
70761
b1742b0066f2
(x-dnd-handle-file-name): Encode and escape file names
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
68651
diff
changeset
|
274 (if coding (setq bf (encode-coding-string bf coding))) |
b1742b0066f2
(x-dnd-handle-file-name): Encode and escape file names
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
68651
diff
changeset
|
275 (let* ((file-uri (concat "file://" |
b1742b0066f2
(x-dnd-handle-file-name): Encode and escape file names
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
68651
diff
changeset
|
276 (mapconcat 'url-hexify-string |
b1742b0066f2
(x-dnd-handle-file-name): Encode and escape file names
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
68651
diff
changeset
|
277 (split-string bf "/") "/"))) |
61476 | 278 (did-action (dnd-handle-one-url window action file-uri))) |
53913
e83b3b3941cf
x-dnd.el: Add COMPOUND_TEXT, handle FILE_NAME correctly, add Motif (CDE)
Jan Djärv <jan.h.d@swipnet.se>
parents:
53823
diff
changeset
|
279 (when did-action (setq retval did-action)))) |
e83b3b3941cf
x-dnd.el: Add COMPOUND_TEXT, handle FILE_NAME correctly, add Motif (CDE)
Jan Djärv <jan.h.d@swipnet.se>
parents:
53823
diff
changeset
|
280 retval)) |
e83b3b3941cf
x-dnd.el: Add COMPOUND_TEXT, handle FILE_NAME correctly, add Motif (CDE)
Jan Djärv <jan.h.d@swipnet.se>
parents:
53823
diff
changeset
|
281 |
53789
7efe8089eadf
* x-dnd.el: New file for drag and drop.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
282 |
7efe8089eadf
* x-dnd.el: New file for drag and drop.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
283 (defun x-dnd-choose-type (types &optional known-types) |
7efe8089eadf
* x-dnd.el: New file for drag and drop.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
284 "Choose which type we want to receive for the drop. |
7efe8089eadf
* x-dnd.el: New file for drag and drop.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
285 TYPES are the types the source of the drop offers, a vector of type names |
7efe8089eadf
* x-dnd.el: New file for drag and drop.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
286 as strings or symbols. Select among the types in `x-dnd-known-types' or |
102285
ece8e00c3763
* x-dnd.el (x-dnd-test-function, x-dnd-get-state-cons-for-frame)
Juanma Barranquero <lekktu@gmail.com>
parents:
100908
diff
changeset
|
287 KNOWN-TYPES if given, and return that type name. |
53789
7efe8089eadf
* x-dnd.el: New file for drag and drop.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
288 If no suitable type is found, return nil." |
7efe8089eadf
* x-dnd.el: New file for drag and drop.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
289 (let* ((known-list (or known-types x-dnd-known-types)) |
7efe8089eadf
* x-dnd.el: New file for drag and drop.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
290 (first-known-type (car known-list)) |
7efe8089eadf
* x-dnd.el: New file for drag and drop.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
291 (types-array types) |
7efe8089eadf
* x-dnd.el: New file for drag and drop.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
292 (found (when first-known-type |
7efe8089eadf
* x-dnd.el: New file for drag and drop.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
293 (catch 'done |
7efe8089eadf
* x-dnd.el: New file for drag and drop.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
294 (dotimes (i (length types-array)) |
7efe8089eadf
* x-dnd.el: New file for drag and drop.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
295 (let* ((type (aref types-array i)) |
7efe8089eadf
* x-dnd.el: New file for drag and drop.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
296 (typename (if (symbolp type) |
7efe8089eadf
* x-dnd.el: New file for drag and drop.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
297 (symbol-name type) type))) |
7efe8089eadf
* x-dnd.el: New file for drag and drop.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
298 (when (equal first-known-type typename) |
7efe8089eadf
* x-dnd.el: New file for drag and drop.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
299 (throw 'done first-known-type)))) |
7efe8089eadf
* x-dnd.el: New file for drag and drop.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
300 nil)))) |
7efe8089eadf
* x-dnd.el: New file for drag and drop.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
301 |
7efe8089eadf
* x-dnd.el: New file for drag and drop.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
302 (if (and (not found) (cdr known-list)) |
7efe8089eadf
* x-dnd.el: New file for drag and drop.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
303 (x-dnd-choose-type types (cdr known-list)) |
7efe8089eadf
* x-dnd.el: New file for drag and drop.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
304 found))) |
7efe8089eadf
* x-dnd.el: New file for drag and drop.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
305 |
7efe8089eadf
* x-dnd.el: New file for drag and drop.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
306 (defun x-dnd-drop-data (event frame window data type) |
7efe8089eadf
* x-dnd.el: New file for drag and drop.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
307 "Drop one data item onto a frame. |
102285
ece8e00c3763
* x-dnd.el (x-dnd-test-function, x-dnd-get-state-cons-for-frame)
Juanma Barranquero <lekktu@gmail.com>
parents:
100908
diff
changeset
|
308 EVENT is the client message for the drop, FRAME is the frame the drop |
ece8e00c3763
* x-dnd.el (x-dnd-test-function, x-dnd-get-state-cons-for-frame)
Juanma Barranquero <lekktu@gmail.com>
parents:
100908
diff
changeset
|
309 occurred on. WINDOW is the window of FRAME where the drop happened. |
ece8e00c3763
* x-dnd.el (x-dnd-test-function, x-dnd-get-state-cons-for-frame)
Juanma Barranquero <lekktu@gmail.com>
parents:
100908
diff
changeset
|
310 DATA is the data received from the source, and type is the type for DATA, |
ece8e00c3763
* x-dnd.el (x-dnd-test-function, x-dnd-get-state-cons-for-frame)
Juanma Barranquero <lekktu@gmail.com>
parents:
100908
diff
changeset
|
311 see `x-dnd-types-alist'). |
53789
7efe8089eadf
* x-dnd.el: New file for drag and drop.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
312 |
7efe8089eadf
* x-dnd.el: New file for drag and drop.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
313 Returns the action used (move, copy, link, private) if drop was successful, |
7efe8089eadf
* x-dnd.el: New file for drag and drop.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
314 nil if not." |
7efe8089eadf
* x-dnd.el: New file for drag and drop.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
315 (let* ((type-info (assoc type x-dnd-types-alist)) |
7efe8089eadf
* x-dnd.el: New file for drag and drop.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
316 (handler (cdr type-info)) |
7efe8089eadf
* x-dnd.el: New file for drag and drop.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
317 (state (x-dnd-get-state-for-frame frame)) |
7efe8089eadf
* x-dnd.el: New file for drag and drop.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
318 (action (aref state 5)) |
7efe8089eadf
* x-dnd.el: New file for drag and drop.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
319 (w (posn-window (event-start event)))) |
7efe8089eadf
* x-dnd.el: New file for drag and drop.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
320 (when handler |
81390
fe478726dca2
(x-dnd-maybe-call-test-function, x-dnd-save-state, x-dnd-drop-data):
Juanma Barranquero <lekktu@gmail.com>
parents:
75347
diff
changeset
|
321 (if (and (window-live-p w) |
65836
c502b2c18f47
(x-dnd-drop-data): Check for dedicated windows.
Richard M. Stallman <rms@gnu.org>
parents:
65807
diff
changeset
|
322 (not (window-minibuffer-p w)) |
c502b2c18f47
(x-dnd-drop-data): Check for dedicated windows.
Richard M. Stallman <rms@gnu.org>
parents:
65807
diff
changeset
|
323 (not (window-dedicated-p w))) |
c502b2c18f47
(x-dnd-drop-data): Check for dedicated windows.
Richard M. Stallman <rms@gnu.org>
parents:
65807
diff
changeset
|
324 ;; If dropping in an ordinary window which we could use, |
c502b2c18f47
(x-dnd-drop-data): Check for dedicated windows.
Richard M. Stallman <rms@gnu.org>
parents:
65807
diff
changeset
|
325 ;; let dnd-open-file-other-window specify what to do. |
65807
637dfc9b8d2e
* x-dnd.el (x-dnd-drop-data): Don't set dnd-open-file-other-window
Jan Djärv <jan.h.d@swipnet.se>
parents:
64762
diff
changeset
|
326 (progn |
72485
030d7ce12631
* x-dnd.el (x-dnd-drop-data): Don't call goto-char if
Jan Djärv <jan.h.d@swipnet.se>
parents:
72356
diff
changeset
|
327 (when (not mouse-yank-at-point) |
030d7ce12631
* x-dnd.el (x-dnd-drop-data): Don't call goto-char if
Jan Djärv <jan.h.d@swipnet.se>
parents:
72356
diff
changeset
|
328 (goto-char (posn-point (event-start event)))) |
53789
7efe8089eadf
* x-dnd.el: New file for drag and drop.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
329 (funcall handler window action data)) |
65836
c502b2c18f47
(x-dnd-drop-data): Check for dedicated windows.
Richard M. Stallman <rms@gnu.org>
parents:
65807
diff
changeset
|
330 ;; If we can't display the file here, |
c502b2c18f47
(x-dnd-drop-data): Check for dedicated windows.
Richard M. Stallman <rms@gnu.org>
parents:
65807
diff
changeset
|
331 ;; make a new window for it. |
c502b2c18f47
(x-dnd-drop-data): Check for dedicated windows.
Richard M. Stallman <rms@gnu.org>
parents:
65807
diff
changeset
|
332 (let ((dnd-open-file-other-window t)) |
53789
7efe8089eadf
* x-dnd.el: New file for drag and drop.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
333 (select-frame frame) |
7efe8089eadf
* x-dnd.el: New file for drag and drop.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
334 (funcall handler window action data)))))) |
7efe8089eadf
* x-dnd.el: New file for drag and drop.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
335 |
7efe8089eadf
* x-dnd.el: New file for drag and drop.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
336 (defun x-dnd-handle-drag-n-drop-event (event) |
7efe8089eadf
* x-dnd.el: New file for drag and drop.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
337 "Receive drag and drop events (X client messages). |
53949
7edbce1dd20a
* x-dnd.el: Mention support for Motif in commentary.
Jan Djärv <jan.h.d@swipnet.se>
parents:
53913
diff
changeset
|
338 Currently XDND, Motif and old KDE 1.x protocols are recognized." |
53789
7efe8089eadf
* x-dnd.el: New file for drag and drop.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
339 (interactive "e") |
7efe8089eadf
* x-dnd.el: New file for drag and drop.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
340 (let* ((client-message (car (cdr (cdr event)))) |
7efe8089eadf
* x-dnd.el: New file for drag and drop.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
341 (window (posn-window (event-start event))) |
7efe8089eadf
* x-dnd.el: New file for drag and drop.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
342 (message-atom (aref client-message 0)) |
7efe8089eadf
* x-dnd.el: New file for drag and drop.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
343 (frame (aref client-message 1)) |
7efe8089eadf
* x-dnd.el: New file for drag and drop.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
344 (format (aref client-message 2)) |
7efe8089eadf
* x-dnd.el: New file for drag and drop.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
345 (data (aref client-message 3))) |
7efe8089eadf
* x-dnd.el: New file for drag and drop.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
346 |
53913
e83b3b3941cf
x-dnd.el: Add COMPOUND_TEXT, handle FILE_NAME correctly, add Motif (CDE)
Jan Djärv <jan.h.d@swipnet.se>
parents:
53823
diff
changeset
|
347 (cond ((equal "DndProtocol" message-atom) ; Old KDE 1.x. |
53789
7efe8089eadf
* x-dnd.el: New file for drag and drop.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
348 (x-dnd-handle-old-kde event frame window message-atom format data)) |
7efe8089eadf
* x-dnd.el: New file for drag and drop.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
349 |
53913
e83b3b3941cf
x-dnd.el: Add COMPOUND_TEXT, handle FILE_NAME correctly, add Motif (CDE)
Jan Djärv <jan.h.d@swipnet.se>
parents:
53823
diff
changeset
|
350 ((equal "_MOTIF_DRAG_AND_DROP_MESSAGE" message-atom) ; Motif |
e83b3b3941cf
x-dnd.el: Add COMPOUND_TEXT, handle FILE_NAME correctly, add Motif (CDE)
Jan Djärv <jan.h.d@swipnet.se>
parents:
53823
diff
changeset
|
351 (x-dnd-handle-motif event frame window message-atom format data)) |
e83b3b3941cf
x-dnd.el: Add COMPOUND_TEXT, handle FILE_NAME correctly, add Motif (CDE)
Jan Djärv <jan.h.d@swipnet.se>
parents:
53823
diff
changeset
|
352 |
e83b3b3941cf
x-dnd.el: Add COMPOUND_TEXT, handle FILE_NAME correctly, add Motif (CDE)
Jan Djärv <jan.h.d@swipnet.se>
parents:
53823
diff
changeset
|
353 ((and (> (length message-atom) 4) ; XDND protocol. |
53789
7efe8089eadf
* x-dnd.el: New file for drag and drop.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
354 (equal "Xdnd" (substring message-atom 0 4))) |
53913
e83b3b3941cf
x-dnd.el: Add COMPOUND_TEXT, handle FILE_NAME correctly, add Motif (CDE)
Jan Djärv <jan.h.d@swipnet.se>
parents:
53823
diff
changeset
|
355 (x-dnd-handle-xdnd event frame window message-atom format data))))) |
53789
7efe8089eadf
* x-dnd.el: New file for drag and drop.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
356 |
7efe8089eadf
* x-dnd.el: New file for drag and drop.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
357 |
7efe8089eadf
* x-dnd.el: New file for drag and drop.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
358 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
7efe8089eadf
* x-dnd.el: New file for drag and drop.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
359 ;;; Old KDE protocol. Only dropping of files. |
7efe8089eadf
* x-dnd.el: New file for drag and drop.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
360 |
95841
b4e36ff621b3
Add some compiler declarations, for builds without X.
Glenn Morris <rgm@gnu.org>
parents:
94678
diff
changeset
|
361 (declare-function x-window-property "xfns.c" |
b4e36ff621b3
Add some compiler declarations, for builds without X.
Glenn Morris <rgm@gnu.org>
parents:
94678
diff
changeset
|
362 (prop &optional frame type source delete-p vector-ret-p)) |
b4e36ff621b3
Add some compiler declarations, for builds without X.
Glenn Morris <rgm@gnu.org>
parents:
94678
diff
changeset
|
363 |
53789
7efe8089eadf
* x-dnd.el: New file for drag and drop.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
364 (defun x-dnd-handle-old-kde (event frame window message format data) |
7efe8089eadf
* x-dnd.el: New file for drag and drop.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
365 "Open the files in a KDE 1.x drop." |
7efe8089eadf
* x-dnd.el: New file for drag and drop.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
366 (let ((values (x-window-property "DndSelection" frame nil 0 t))) |
7efe8089eadf
* x-dnd.el: New file for drag and drop.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
367 (x-dnd-handle-uri-list window 'private |
7efe8089eadf
* x-dnd.el: New file for drag and drop.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
368 (replace-regexp-in-string "\0$" "" values)))) |
7efe8089eadf
* x-dnd.el: New file for drag and drop.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
369 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
7efe8089eadf
* x-dnd.el: New file for drag and drop.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
370 |
7efe8089eadf
* x-dnd.el: New file for drag and drop.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
371 |
7efe8089eadf
* x-dnd.el: New file for drag and drop.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
372 |
7efe8089eadf
* x-dnd.el: New file for drag and drop.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
373 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
7efe8089eadf
* x-dnd.el: New file for drag and drop.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
374 ;;; XDND protocol. |
7efe8089eadf
* x-dnd.el: New file for drag and drop.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
375 |
105765
db5e4a5897ec
* textmodes/tex-mode.el (tex-dvi-view-command)
Dan Nicolaescu <dann@ics.uci.edu>
parents:
104823
diff
changeset
|
376 (defconst x-dnd-xdnd-to-action |
53789
7efe8089eadf
* x-dnd.el: New file for drag and drop.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
377 '(("XdndActionPrivate" . private) |
7efe8089eadf
* x-dnd.el: New file for drag and drop.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
378 ("XdndActionCopy" . copy) |
7efe8089eadf
* x-dnd.el: New file for drag and drop.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
379 ("XdndActionMove" . move) |
7efe8089eadf
* x-dnd.el: New file for drag and drop.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
380 ("XdndActionLink" . link) |
7efe8089eadf
* x-dnd.el: New file for drag and drop.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
381 ("XdndActionAsk" . ask)) |
7efe8089eadf
* x-dnd.el: New file for drag and drop.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
382 "Mapping from XDND action types to lisp symbols.") |
7efe8089eadf
* x-dnd.el: New file for drag and drop.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
383 |
95841
b4e36ff621b3
Add some compiler declarations, for builds without X.
Glenn Morris <rgm@gnu.org>
parents:
94678
diff
changeset
|
384 (declare-function x-change-window-property "xfns.c" |
b4e36ff621b3
Add some compiler declarations, for builds without X.
Glenn Morris <rgm@gnu.org>
parents:
94678
diff
changeset
|
385 (prop value &optional frame type format outer-P)) |
b4e36ff621b3
Add some compiler declarations, for builds without X.
Glenn Morris <rgm@gnu.org>
parents:
94678
diff
changeset
|
386 |
53789
7efe8089eadf
* x-dnd.el: New file for drag and drop.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
387 (defun x-dnd-init-xdnd-for-frame (frame) |
53913
e83b3b3941cf
x-dnd.el: Add COMPOUND_TEXT, handle FILE_NAME correctly, add Motif (CDE)
Jan Djärv <jan.h.d@swipnet.se>
parents:
53823
diff
changeset
|
388 "Set the XdndAware property for FRAME to indicate that we do XDND." |
53789
7efe8089eadf
* x-dnd.el: New file for drag and drop.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
389 (x-change-window-property "XdndAware" |
7efe8089eadf
* x-dnd.el: New file for drag and drop.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
390 '(5) ;; The version of XDND we support. |
7efe8089eadf
* x-dnd.el: New file for drag and drop.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
391 frame "ATOM" 32 t)) |
7efe8089eadf
* x-dnd.el: New file for drag and drop.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
392 |
7efe8089eadf
* x-dnd.el: New file for drag and drop.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
393 (defun x-dnd-get-drop-width-height (frame w accept) |
102285
ece8e00c3763
* x-dnd.el (x-dnd-test-function, x-dnd-get-state-cons-for-frame)
Juanma Barranquero <lekktu@gmail.com>
parents:
100908
diff
changeset
|
394 "Return the width/height to be sent in a XDndStatus message. |
53789
7efe8089eadf
* x-dnd.el: New file for drag and drop.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
395 FRAME is the frame and W is the window where the drop happened. |
7efe8089eadf
* x-dnd.el: New file for drag and drop.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
396 If ACCEPT is nil return 0 (empty rectangle), |
102285
ece8e00c3763
* x-dnd.el (x-dnd-test-function, x-dnd-get-state-cons-for-frame)
Juanma Barranquero <lekktu@gmail.com>
parents:
100908
diff
changeset
|
397 otherwise if W is a window, return its width/height, |
53789
7efe8089eadf
* x-dnd.el: New file for drag and drop.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
398 otherwise return the frame width/height." |
7efe8089eadf
* x-dnd.el: New file for drag and drop.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
399 (if accept |
7efe8089eadf
* x-dnd.el: New file for drag and drop.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
400 (if (windowp w) ;; w is not a window if dropping on the menu bar, |
7efe8089eadf
* x-dnd.el: New file for drag and drop.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
401 ;; scroll bar or tool bar. |
7efe8089eadf
* x-dnd.el: New file for drag and drop.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
402 (let ((edges (window-inside-pixel-edges w))) |
7efe8089eadf
* x-dnd.el: New file for drag and drop.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
403 (cons |
7efe8089eadf
* x-dnd.el: New file for drag and drop.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
404 (- (nth 2 edges) (nth 0 edges)) ;; right - left |
7efe8089eadf
* x-dnd.el: New file for drag and drop.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
405 (- (nth 3 edges) (nth 1 edges)))) ;; bottom - top |
7efe8089eadf
* x-dnd.el: New file for drag and drop.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
406 (cons (frame-pixel-width frame) |
7efe8089eadf
* x-dnd.el: New file for drag and drop.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
407 (frame-pixel-height frame))) |
7efe8089eadf
* x-dnd.el: New file for drag and drop.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
408 0)) |
7efe8089eadf
* x-dnd.el: New file for drag and drop.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
409 |
7efe8089eadf
* x-dnd.el: New file for drag and drop.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
410 (defun x-dnd-get-drop-x-y (frame w) |
7efe8089eadf
* x-dnd.el: New file for drag and drop.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
411 "Return the x/y coordinates to be sent in a XDndStatus message. |
7efe8089eadf
* x-dnd.el: New file for drag and drop.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
412 Coordinates are required to be absolute. |
7efe8089eadf
* x-dnd.el: New file for drag and drop.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
413 FRAME is the frame and W is the window where the drop happened. |
7efe8089eadf
* x-dnd.el: New file for drag and drop.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
414 If W is a window, return its absolute corrdinates, |
7efe8089eadf
* x-dnd.el: New file for drag and drop.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
415 otherwise return the frame coordinates." |
7efe8089eadf
* x-dnd.el: New file for drag and drop.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
416 (let* ((frame-left (frame-parameter frame 'left)) |
7efe8089eadf
* x-dnd.el: New file for drag and drop.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
417 ;; If the frame is outside the display, frame-left looks like |
7efe8089eadf
* x-dnd.el: New file for drag and drop.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
418 ;; '(0 -16). Extract the -16. |
7efe8089eadf
* x-dnd.el: New file for drag and drop.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
419 (frame-real-left (if (consp frame-left) (car (cdr frame-left)) |
7efe8089eadf
* x-dnd.el: New file for drag and drop.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
420 frame-left)) |
7efe8089eadf
* x-dnd.el: New file for drag and drop.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
421 (frame-top (frame-parameter frame 'top)) |
7efe8089eadf
* x-dnd.el: New file for drag and drop.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
422 (frame-real-top (if (consp frame-top) (car (cdr frame-top)) |
7efe8089eadf
* x-dnd.el: New file for drag and drop.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
423 frame-top))) |
7efe8089eadf
* x-dnd.el: New file for drag and drop.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
424 (if (windowp w) |
7efe8089eadf
* x-dnd.el: New file for drag and drop.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
425 (let ((edges (window-inside-pixel-edges w))) |
7efe8089eadf
* x-dnd.el: New file for drag and drop.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
426 (cons |
7efe8089eadf
* x-dnd.el: New file for drag and drop.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
427 (+ frame-real-left (nth 0 edges)) |
7efe8089eadf
* x-dnd.el: New file for drag and drop.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
428 (+ frame-real-top (nth 1 edges)))) |
7efe8089eadf
* x-dnd.el: New file for drag and drop.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
429 (cons frame-real-left frame-real-top)))) |
7efe8089eadf
* x-dnd.el: New file for drag and drop.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
430 |
95841
b4e36ff621b3
Add some compiler declarations, for builds without X.
Glenn Morris <rgm@gnu.org>
parents:
94678
diff
changeset
|
431 (declare-function x-get-atom-name "xselect.c" (value &optional frame)) |
b4e36ff621b3
Add some compiler declarations, for builds without X.
Glenn Morris <rgm@gnu.org>
parents:
94678
diff
changeset
|
432 (declare-function x-send-client-message "xselect.c" |
b4e36ff621b3
Add some compiler declarations, for builds without X.
Glenn Morris <rgm@gnu.org>
parents:
94678
diff
changeset
|
433 (display dest from message-type format values)) |
b4e36ff621b3
Add some compiler declarations, for builds without X.
Glenn Morris <rgm@gnu.org>
parents:
94678
diff
changeset
|
434 (declare-function x-get-selection-internal "xselect.c" |
b4e36ff621b3
Add some compiler declarations, for builds without X.
Glenn Morris <rgm@gnu.org>
parents:
94678
diff
changeset
|
435 (selection-symbol target-type &optional time-stamp)) |
86325
613267d53431
(x-register-dnd-atom, x-get-atom-name, x-send-client-message):
Juanma Barranquero <lekktu@gmail.com>
parents:
83648
diff
changeset
|
436 |
53789
7efe8089eadf
* x-dnd.el: New file for drag and drop.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
437 (defun x-dnd-handle-xdnd (event frame window message format data) |
7efe8089eadf
* x-dnd.el: New file for drag and drop.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
438 "Receive one XDND event (client message) and send the appropriate reply. |
7efe8089eadf
* x-dnd.el: New file for drag and drop.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
439 EVENT is the client message. FRAME is where the mouse is now. |
7efe8089eadf
* x-dnd.el: New file for drag and drop.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
440 WINDOW is the window within FRAME where the mouse is now. |
7efe8089eadf
* x-dnd.el: New file for drag and drop.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
441 FORMAT is 32 (not used). MESSAGE is the data part of an XClientMessageEvent." |
7efe8089eadf
* x-dnd.el: New file for drag and drop.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
442 (cond ((equal "XdndEnter" message) |
59932
c7c51386376c
* x-dnd.el (x-dnd-handle-xdnd): Handle the case where the flags
Jan Djärv <jan.h.d@swipnet.se>
parents:
57811
diff
changeset
|
443 (let* ((flags (aref data 1)) |
c7c51386376c
* x-dnd.el (x-dnd-handle-xdnd): Handle the case where the flags
Jan Djärv <jan.h.d@swipnet.se>
parents:
57811
diff
changeset
|
444 (version (and (consp flags) (ash (car flags) -8))) |
c7c51386376c
* x-dnd.el (x-dnd-handle-xdnd): Handle the case where the flags
Jan Djärv <jan.h.d@swipnet.se>
parents:
57811
diff
changeset
|
445 (more-than-3 (and (consp flags) (cdr flags))) |
c7c51386376c
* x-dnd.el (x-dnd-handle-xdnd): Handle the case where the flags
Jan Djärv <jan.h.d@swipnet.se>
parents:
57811
diff
changeset
|
446 (dnd-source (aref data 0))) |
c7c51386376c
* x-dnd.el (x-dnd-handle-xdnd): Handle the case where the flags
Jan Djärv <jan.h.d@swipnet.se>
parents:
57811
diff
changeset
|
447 (if version ;; If flags is bad, version will be nil. |
c7c51386376c
* x-dnd.el (x-dnd-handle-xdnd): Handle the case where the flags
Jan Djärv <jan.h.d@swipnet.se>
parents:
57811
diff
changeset
|
448 (x-dnd-save-state |
c7c51386376c
* x-dnd.el (x-dnd-handle-xdnd): Handle the case where the flags
Jan Djärv <jan.h.d@swipnet.se>
parents:
57811
diff
changeset
|
449 window nil nil |
c7c51386376c
* x-dnd.el (x-dnd-handle-xdnd): Handle the case where the flags
Jan Djärv <jan.h.d@swipnet.se>
parents:
57811
diff
changeset
|
450 (if (> more-than-3 0) |
c7c51386376c
* x-dnd.el (x-dnd-handle-xdnd): Handle the case where the flags
Jan Djärv <jan.h.d@swipnet.se>
parents:
57811
diff
changeset
|
451 (x-window-property "XdndTypeList" |
c7c51386376c
* x-dnd.el (x-dnd-handle-xdnd): Handle the case where the flags
Jan Djärv <jan.h.d@swipnet.se>
parents:
57811
diff
changeset
|
452 frame "AnyPropertyType" |
c7c51386376c
* x-dnd.el (x-dnd-handle-xdnd): Handle the case where the flags
Jan Djärv <jan.h.d@swipnet.se>
parents:
57811
diff
changeset
|
453 dnd-source nil t) |
c7c51386376c
* x-dnd.el (x-dnd-handle-xdnd): Handle the case where the flags
Jan Djärv <jan.h.d@swipnet.se>
parents:
57811
diff
changeset
|
454 (vector (x-get-atom-name (aref data 2)) |
c7c51386376c
* x-dnd.el (x-dnd-handle-xdnd): Handle the case where the flags
Jan Djärv <jan.h.d@swipnet.se>
parents:
57811
diff
changeset
|
455 (x-get-atom-name (aref data 3)) |
c7c51386376c
* x-dnd.el (x-dnd-handle-xdnd): Handle the case where the flags
Jan Djärv <jan.h.d@swipnet.se>
parents:
57811
diff
changeset
|
456 (x-get-atom-name (aref data 4)))))))) |
53789
7efe8089eadf
* x-dnd.el: New file for drag and drop.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
457 |
7efe8089eadf
* x-dnd.el: New file for drag and drop.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
458 ((equal "XdndPosition" message) |
7efe8089eadf
* x-dnd.el: New file for drag and drop.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
459 (let* ((x (car (aref data 2))) |
7efe8089eadf
* x-dnd.el: New file for drag and drop.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
460 (y (cdr (aref data 2))) |
7efe8089eadf
* x-dnd.el: New file for drag and drop.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
461 (action (x-get-atom-name (aref data 4))) |
7efe8089eadf
* x-dnd.el: New file for drag and drop.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
462 (dnd-source (aref data 0)) |
7efe8089eadf
* x-dnd.el: New file for drag and drop.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
463 (dnd-time (aref data 3)) |
7efe8089eadf
* x-dnd.el: New file for drag and drop.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
464 (action-type (x-dnd-maybe-call-test-function |
7efe8089eadf
* x-dnd.el: New file for drag and drop.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
465 window |
7efe8089eadf
* x-dnd.el: New file for drag and drop.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
466 (cdr (assoc action x-dnd-xdnd-to-action)))) |
7efe8089eadf
* x-dnd.el: New file for drag and drop.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
467 (reply-action (car (rassoc (car action-type) |
7efe8089eadf
* x-dnd.el: New file for drag and drop.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
468 x-dnd-xdnd-to-action))) |
7efe8089eadf
* x-dnd.el: New file for drag and drop.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
469 (accept ;; 1 = accept, 0 = reject |
7efe8089eadf
* x-dnd.el: New file for drag and drop.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
470 (if (and reply-action action-type) 1 0)) |
7efe8089eadf
* x-dnd.el: New file for drag and drop.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
471 (list-to-send |
7efe8089eadf
* x-dnd.el: New file for drag and drop.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
472 (list (string-to-number |
7efe8089eadf
* x-dnd.el: New file for drag and drop.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
473 (frame-parameter frame 'outer-window-id)) |
7efe8089eadf
* x-dnd.el: New file for drag and drop.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
474 accept ;; 1 = Accept, 0 = reject. |
7efe8089eadf
* x-dnd.el: New file for drag and drop.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
475 (x-dnd-get-drop-x-y frame window) |
59996
aac0a33f5772
Change release version from 21.4 to 22.1 throughout.
Kim F. Storm <storm@cua.dk>
parents:
59932
diff
changeset
|
476 (x-dnd-get-drop-width-height |
53789
7efe8089eadf
* x-dnd.el: New file for drag and drop.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
477 frame window (eq accept 1)) |
7efe8089eadf
* x-dnd.el: New file for drag and drop.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
478 (or reply-action 0) |
7efe8089eadf
* x-dnd.el: New file for drag and drop.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
479 ))) |
7efe8089eadf
* x-dnd.el: New file for drag and drop.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
480 (x-send-client-message |
7efe8089eadf
* x-dnd.el: New file for drag and drop.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
481 frame dnd-source frame "XdndStatus" 32 list-to-send) |
7efe8089eadf
* x-dnd.el: New file for drag and drop.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
482 )) |
7efe8089eadf
* x-dnd.el: New file for drag and drop.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
483 |
7efe8089eadf
* x-dnd.el: New file for drag and drop.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
484 ((equal "XdndLeave" message) |
7efe8089eadf
* x-dnd.el: New file for drag and drop.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
485 (x-dnd-forget-drop window)) |
7efe8089eadf
* x-dnd.el: New file for drag and drop.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
486 |
7efe8089eadf
* x-dnd.el: New file for drag and drop.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
487 ((equal "XdndDrop" message) |
7efe8089eadf
* x-dnd.el: New file for drag and drop.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
488 (if (windowp window) (select-window window)) |
7efe8089eadf
* x-dnd.el: New file for drag and drop.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
489 (let* ((dnd-source (aref data 0)) |
7efe8089eadf
* x-dnd.el: New file for drag and drop.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
490 (value (and (x-dnd-current-type window) |
7efe8089eadf
* x-dnd.el: New file for drag and drop.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
491 (x-get-selection-internal |
7efe8089eadf
* x-dnd.el: New file for drag and drop.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
492 'XdndSelection |
7efe8089eadf
* x-dnd.el: New file for drag and drop.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
493 (intern (x-dnd-current-type window))))) |
7efe8089eadf
* x-dnd.el: New file for drag and drop.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
494 success action ret-action) |
7efe8089eadf
* x-dnd.el: New file for drag and drop.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
495 |
7efe8089eadf
* x-dnd.el: New file for drag and drop.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
496 (setq action (if value |
7efe8089eadf
* x-dnd.el: New file for drag and drop.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
497 (condition-case info |
59996
aac0a33f5772
Change release version from 21.4 to 22.1 throughout.
Kim F. Storm <storm@cua.dk>
parents:
59932
diff
changeset
|
498 (x-dnd-drop-data event frame window value |
53789
7efe8089eadf
* x-dnd.el: New file for drag and drop.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
499 (x-dnd-current-type window)) |
59996
aac0a33f5772
Change release version from 21.4 to 22.1 throughout.
Kim F. Storm <storm@cua.dk>
parents:
59932
diff
changeset
|
500 (error |
53789
7efe8089eadf
* x-dnd.el: New file for drag and drop.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
501 (message "Error: %s" info) |
7efe8089eadf
* x-dnd.el: New file for drag and drop.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
502 nil)))) |
7efe8089eadf
* x-dnd.el: New file for drag and drop.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
503 |
7efe8089eadf
* x-dnd.el: New file for drag and drop.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
504 (setq success (if action 1 0)) |
7efe8089eadf
* x-dnd.el: New file for drag and drop.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
505 (setq ret-action |
7efe8089eadf
* x-dnd.el: New file for drag and drop.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
506 (if (eq success 1) |
7efe8089eadf
* x-dnd.el: New file for drag and drop.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
507 (or (car (rassoc action x-dnd-xdnd-to-action)) |
7efe8089eadf
* x-dnd.el: New file for drag and drop.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
508 "XdndActionPrivate") |
7efe8089eadf
* x-dnd.el: New file for drag and drop.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
509 0)) |
7efe8089eadf
* x-dnd.el: New file for drag and drop.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
510 |
7efe8089eadf
* x-dnd.el: New file for drag and drop.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
511 (x-send-client-message |
7efe8089eadf
* x-dnd.el: New file for drag and drop.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
512 frame dnd-source frame "XdndFinished" 32 |
7efe8089eadf
* x-dnd.el: New file for drag and drop.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
513 (list (string-to-number (frame-parameter frame 'outer-window-id)) |
7efe8089eadf
* x-dnd.el: New file for drag and drop.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
514 success ;; 1 = Success, 0 = Error |
7efe8089eadf
* x-dnd.el: New file for drag and drop.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
515 (if success "XdndActionPrivate" 0) |
7efe8089eadf
* x-dnd.el: New file for drag and drop.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
516 )) |
7efe8089eadf
* x-dnd.el: New file for drag and drop.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
517 (x-dnd-forget-drop window))) |
7efe8089eadf
* x-dnd.el: New file for drag and drop.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
518 |
7efe8089eadf
* x-dnd.el: New file for drag and drop.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
519 (t (error "Unknown XDND message %s %s" message data)))) |
7efe8089eadf
* x-dnd.el: New file for drag and drop.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
520 |
53913
e83b3b3941cf
x-dnd.el: Add COMPOUND_TEXT, handle FILE_NAME correctly, add Motif (CDE)
Jan Djärv <jan.h.d@swipnet.se>
parents:
53823
diff
changeset
|
521 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
e83b3b3941cf
x-dnd.el: Add COMPOUND_TEXT, handle FILE_NAME correctly, add Motif (CDE)
Jan Djärv <jan.h.d@swipnet.se>
parents:
53823
diff
changeset
|
522 ;;; Motif protocol. |
e83b3b3941cf
x-dnd.el: Add COMPOUND_TEXT, handle FILE_NAME correctly, add Motif (CDE)
Jan Djärv <jan.h.d@swipnet.se>
parents:
53823
diff
changeset
|
523 |
e83b3b3941cf
x-dnd.el: Add COMPOUND_TEXT, handle FILE_NAME correctly, add Motif (CDE)
Jan Djärv <jan.h.d@swipnet.se>
parents:
53823
diff
changeset
|
524 (defun x-dnd-init-motif-for-frame (frame) |
102285
ece8e00c3763
* x-dnd.el (x-dnd-test-function, x-dnd-get-state-cons-for-frame)
Juanma Barranquero <lekktu@gmail.com>
parents:
100908
diff
changeset
|
525 "Set _MOTIF_DRAG_RECEIVER_INFO for FRAME to indicate that we do Motif DND." |
53913
e83b3b3941cf
x-dnd.el: Add COMPOUND_TEXT, handle FILE_NAME correctly, add Motif (CDE)
Jan Djärv <jan.h.d@swipnet.se>
parents:
53823
diff
changeset
|
526 (x-change-window-property "_MOTIF_DRAG_RECEIVER_INFO" |
e83b3b3941cf
x-dnd.el: Add COMPOUND_TEXT, handle FILE_NAME correctly, add Motif (CDE)
Jan Djärv <jan.h.d@swipnet.se>
parents:
53823
diff
changeset
|
527 (list |
e83b3b3941cf
x-dnd.el: Add COMPOUND_TEXT, handle FILE_NAME correctly, add Motif (CDE)
Jan Djärv <jan.h.d@swipnet.se>
parents:
53823
diff
changeset
|
528 (byteorder) |
e83b3b3941cf
x-dnd.el: Add COMPOUND_TEXT, handle FILE_NAME correctly, add Motif (CDE)
Jan Djärv <jan.h.d@swipnet.se>
parents:
53823
diff
changeset
|
529 0 ; The Motif DND version. |
e83b3b3941cf
x-dnd.el: Add COMPOUND_TEXT, handle FILE_NAME correctly, add Motif (CDE)
Jan Djärv <jan.h.d@swipnet.se>
parents:
53823
diff
changeset
|
530 5 ; We want drag dynamic. |
e83b3b3941cf
x-dnd.el: Add COMPOUND_TEXT, handle FILE_NAME correctly, add Motif (CDE)
Jan Djärv <jan.h.d@swipnet.se>
parents:
53823
diff
changeset
|
531 0 0 0 0 0 0 0 |
e83b3b3941cf
x-dnd.el: Add COMPOUND_TEXT, handle FILE_NAME correctly, add Motif (CDE)
Jan Djärv <jan.h.d@swipnet.se>
parents:
53823
diff
changeset
|
532 0 0 0 0 0 0) ; Property must be 16 bytes. |
e83b3b3941cf
x-dnd.el: Add COMPOUND_TEXT, handle FILE_NAME correctly, add Motif (CDE)
Jan Djärv <jan.h.d@swipnet.se>
parents:
53823
diff
changeset
|
533 frame "_MOTIF_DRAG_RECEIVER_INFO" 8 t)) |
e83b3b3941cf
x-dnd.el: Add COMPOUND_TEXT, handle FILE_NAME correctly, add Motif (CDE)
Jan Djärv <jan.h.d@swipnet.se>
parents:
53823
diff
changeset
|
534 |
e83b3b3941cf
x-dnd.el: Add COMPOUND_TEXT, handle FILE_NAME correctly, add Motif (CDE)
Jan Djärv <jan.h.d@swipnet.se>
parents:
53823
diff
changeset
|
535 (defun x-dnd-get-motif-value (data offset size byteorder) |
e83b3b3941cf
x-dnd.el: Add COMPOUND_TEXT, handle FILE_NAME correctly, add Motif (CDE)
Jan Djärv <jan.h.d@swipnet.se>
parents:
53823
diff
changeset
|
536 (cond ((eq size 2) |
e83b3b3941cf
x-dnd.el: Add COMPOUND_TEXT, handle FILE_NAME correctly, add Motif (CDE)
Jan Djärv <jan.h.d@swipnet.se>
parents:
53823
diff
changeset
|
537 (if (eq byteorder ?l) |
e83b3b3941cf
x-dnd.el: Add COMPOUND_TEXT, handle FILE_NAME correctly, add Motif (CDE)
Jan Djärv <jan.h.d@swipnet.se>
parents:
53823
diff
changeset
|
538 (+ (ash (aref data (1+ offset)) 8) |
e83b3b3941cf
x-dnd.el: Add COMPOUND_TEXT, handle FILE_NAME correctly, add Motif (CDE)
Jan Djärv <jan.h.d@swipnet.se>
parents:
53823
diff
changeset
|
539 (aref data offset)) |
e83b3b3941cf
x-dnd.el: Add COMPOUND_TEXT, handle FILE_NAME correctly, add Motif (CDE)
Jan Djärv <jan.h.d@swipnet.se>
parents:
53823
diff
changeset
|
540 (+ (ash (aref data offset) 8) |
e83b3b3941cf
x-dnd.el: Add COMPOUND_TEXT, handle FILE_NAME correctly, add Motif (CDE)
Jan Djärv <jan.h.d@swipnet.se>
parents:
53823
diff
changeset
|
541 (aref data (1+ offset))))) |
e83b3b3941cf
x-dnd.el: Add COMPOUND_TEXT, handle FILE_NAME correctly, add Motif (CDE)
Jan Djärv <jan.h.d@swipnet.se>
parents:
53823
diff
changeset
|
542 |
e83b3b3941cf
x-dnd.el: Add COMPOUND_TEXT, handle FILE_NAME correctly, add Motif (CDE)
Jan Djärv <jan.h.d@swipnet.se>
parents:
53823
diff
changeset
|
543 ((eq size 4) |
e83b3b3941cf
x-dnd.el: Add COMPOUND_TEXT, handle FILE_NAME correctly, add Motif (CDE)
Jan Djärv <jan.h.d@swipnet.se>
parents:
53823
diff
changeset
|
544 (if (eq byteorder ?l) |
e83b3b3941cf
x-dnd.el: Add COMPOUND_TEXT, handle FILE_NAME correctly, add Motif (CDE)
Jan Djärv <jan.h.d@swipnet.se>
parents:
53823
diff
changeset
|
545 (cons (+ (ash (aref data (+ 3 offset)) 8) |
e83b3b3941cf
x-dnd.el: Add COMPOUND_TEXT, handle FILE_NAME correctly, add Motif (CDE)
Jan Djärv <jan.h.d@swipnet.se>
parents:
53823
diff
changeset
|
546 (aref data (+ 2 offset))) |
e83b3b3941cf
x-dnd.el: Add COMPOUND_TEXT, handle FILE_NAME correctly, add Motif (CDE)
Jan Djärv <jan.h.d@swipnet.se>
parents:
53823
diff
changeset
|
547 (+ (ash (aref data (1+ offset)) 8) |
e83b3b3941cf
x-dnd.el: Add COMPOUND_TEXT, handle FILE_NAME correctly, add Motif (CDE)
Jan Djärv <jan.h.d@swipnet.se>
parents:
53823
diff
changeset
|
548 (aref data offset))) |
e83b3b3941cf
x-dnd.el: Add COMPOUND_TEXT, handle FILE_NAME correctly, add Motif (CDE)
Jan Djärv <jan.h.d@swipnet.se>
parents:
53823
diff
changeset
|
549 (cons (+ (ash (aref data offset) 8) |
e83b3b3941cf
x-dnd.el: Add COMPOUND_TEXT, handle FILE_NAME correctly, add Motif (CDE)
Jan Djärv <jan.h.d@swipnet.se>
parents:
53823
diff
changeset
|
550 (aref data (1+ offset))) |
e83b3b3941cf
x-dnd.el: Add COMPOUND_TEXT, handle FILE_NAME correctly, add Motif (CDE)
Jan Djärv <jan.h.d@swipnet.se>
parents:
53823
diff
changeset
|
551 (+ (ash (aref data (+ 2 offset)) 8) |
e83b3b3941cf
x-dnd.el: Add COMPOUND_TEXT, handle FILE_NAME correctly, add Motif (CDE)
Jan Djärv <jan.h.d@swipnet.se>
parents:
53823
diff
changeset
|
552 (aref data (+ 3 offset)))))))) |
e83b3b3941cf
x-dnd.el: Add COMPOUND_TEXT, handle FILE_NAME correctly, add Motif (CDE)
Jan Djärv <jan.h.d@swipnet.se>
parents:
53823
diff
changeset
|
553 |
e83b3b3941cf
x-dnd.el: Add COMPOUND_TEXT, handle FILE_NAME correctly, add Motif (CDE)
Jan Djärv <jan.h.d@swipnet.se>
parents:
53823
diff
changeset
|
554 (defun x-dnd-motif-value-to-list (value size byteorder) |
e83b3b3941cf
x-dnd.el: Add COMPOUND_TEXT, handle FILE_NAME correctly, add Motif (CDE)
Jan Djärv <jan.h.d@swipnet.se>
parents:
53823
diff
changeset
|
555 (let ((bytes (cond ((eq size 2) |
e83b3b3941cf
x-dnd.el: Add COMPOUND_TEXT, handle FILE_NAME correctly, add Motif (CDE)
Jan Djärv <jan.h.d@swipnet.se>
parents:
53823
diff
changeset
|
556 (list (logand (lsh value -8) ?\xff) |
e83b3b3941cf
x-dnd.el: Add COMPOUND_TEXT, handle FILE_NAME correctly, add Motif (CDE)
Jan Djärv <jan.h.d@swipnet.se>
parents:
53823
diff
changeset
|
557 (logand value ?\xff))) |
e83b3b3941cf
x-dnd.el: Add COMPOUND_TEXT, handle FILE_NAME correctly, add Motif (CDE)
Jan Djärv <jan.h.d@swipnet.se>
parents:
53823
diff
changeset
|
558 |
e83b3b3941cf
x-dnd.el: Add COMPOUND_TEXT, handle FILE_NAME correctly, add Motif (CDE)
Jan Djärv <jan.h.d@swipnet.se>
parents:
53823
diff
changeset
|
559 ((eq size 4) |
e83b3b3941cf
x-dnd.el: Add COMPOUND_TEXT, handle FILE_NAME correctly, add Motif (CDE)
Jan Djärv <jan.h.d@swipnet.se>
parents:
53823
diff
changeset
|
560 (if (consp value) |
e83b3b3941cf
x-dnd.el: Add COMPOUND_TEXT, handle FILE_NAME correctly, add Motif (CDE)
Jan Djärv <jan.h.d@swipnet.se>
parents:
53823
diff
changeset
|
561 (list (logand (lsh (car value) -8) ?\xff) |
e83b3b3941cf
x-dnd.el: Add COMPOUND_TEXT, handle FILE_NAME correctly, add Motif (CDE)
Jan Djärv <jan.h.d@swipnet.se>
parents:
53823
diff
changeset
|
562 (logand (car value) ?\xff) |
e83b3b3941cf
x-dnd.el: Add COMPOUND_TEXT, handle FILE_NAME correctly, add Motif (CDE)
Jan Djärv <jan.h.d@swipnet.se>
parents:
53823
diff
changeset
|
563 (logand (lsh (cdr value) -8) ?\xff) |
e83b3b3941cf
x-dnd.el: Add COMPOUND_TEXT, handle FILE_NAME correctly, add Motif (CDE)
Jan Djärv <jan.h.d@swipnet.se>
parents:
53823
diff
changeset
|
564 (logand (cdr value) ?\xff)) |
e83b3b3941cf
x-dnd.el: Add COMPOUND_TEXT, handle FILE_NAME correctly, add Motif (CDE)
Jan Djärv <jan.h.d@swipnet.se>
parents:
53823
diff
changeset
|
565 (list (logand (lsh value -24) ?\xff) |
e83b3b3941cf
x-dnd.el: Add COMPOUND_TEXT, handle FILE_NAME correctly, add Motif (CDE)
Jan Djärv <jan.h.d@swipnet.se>
parents:
53823
diff
changeset
|
566 (logand (lsh value -16) ?\xff) |
e83b3b3941cf
x-dnd.el: Add COMPOUND_TEXT, handle FILE_NAME correctly, add Motif (CDE)
Jan Djärv <jan.h.d@swipnet.se>
parents:
53823
diff
changeset
|
567 (logand (lsh value -8) ?\xff) |
e83b3b3941cf
x-dnd.el: Add COMPOUND_TEXT, handle FILE_NAME correctly, add Motif (CDE)
Jan Djärv <jan.h.d@swipnet.se>
parents:
53823
diff
changeset
|
568 (logand value ?\xff))))))) |
e83b3b3941cf
x-dnd.el: Add COMPOUND_TEXT, handle FILE_NAME correctly, add Motif (CDE)
Jan Djärv <jan.h.d@swipnet.se>
parents:
53823
diff
changeset
|
569 (if (eq byteorder ?l) |
e83b3b3941cf
x-dnd.el: Add COMPOUND_TEXT, handle FILE_NAME correctly, add Motif (CDE)
Jan Djärv <jan.h.d@swipnet.se>
parents:
53823
diff
changeset
|
570 (reverse bytes) |
e83b3b3941cf
x-dnd.el: Add COMPOUND_TEXT, handle FILE_NAME correctly, add Motif (CDE)
Jan Djärv <jan.h.d@swipnet.se>
parents:
53823
diff
changeset
|
571 bytes))) |
e83b3b3941cf
x-dnd.el: Add COMPOUND_TEXT, handle FILE_NAME correctly, add Motif (CDE)
Jan Djärv <jan.h.d@swipnet.se>
parents:
53823
diff
changeset
|
572 |
e83b3b3941cf
x-dnd.el: Add COMPOUND_TEXT, handle FILE_NAME correctly, add Motif (CDE)
Jan Djärv <jan.h.d@swipnet.se>
parents:
53823
diff
changeset
|
573 |
e83b3b3941cf
x-dnd.el: Add COMPOUND_TEXT, handle FILE_NAME correctly, add Motif (CDE)
Jan Djärv <jan.h.d@swipnet.se>
parents:
53823
diff
changeset
|
574 (defvar x-dnd-motif-message-types |
e83b3b3941cf
x-dnd.el: Add COMPOUND_TEXT, handle FILE_NAME correctly, add Motif (CDE)
Jan Djärv <jan.h.d@swipnet.se>
parents:
53823
diff
changeset
|
575 '((0 . XmTOP_LEVEL_ENTER) |
e83b3b3941cf
x-dnd.el: Add COMPOUND_TEXT, handle FILE_NAME correctly, add Motif (CDE)
Jan Djärv <jan.h.d@swipnet.se>
parents:
53823
diff
changeset
|
576 (1 . XmTOP_LEVEL_LEAVE) |
e83b3b3941cf
x-dnd.el: Add COMPOUND_TEXT, handle FILE_NAME correctly, add Motif (CDE)
Jan Djärv <jan.h.d@swipnet.se>
parents:
53823
diff
changeset
|
577 (2 . XmDRAG_MOTION) |
e83b3b3941cf
x-dnd.el: Add COMPOUND_TEXT, handle FILE_NAME correctly, add Motif (CDE)
Jan Djärv <jan.h.d@swipnet.se>
parents:
53823
diff
changeset
|
578 (3 . XmDROP_SITE_ENTER) |
e83b3b3941cf
x-dnd.el: Add COMPOUND_TEXT, handle FILE_NAME correctly, add Motif (CDE)
Jan Djärv <jan.h.d@swipnet.se>
parents:
53823
diff
changeset
|
579 (4 . XmDROP_SITE_LEAVE) |
e83b3b3941cf
x-dnd.el: Add COMPOUND_TEXT, handle FILE_NAME correctly, add Motif (CDE)
Jan Djärv <jan.h.d@swipnet.se>
parents:
53823
diff
changeset
|
580 (5 . XmDROP_START) |
e83b3b3941cf
x-dnd.el: Add COMPOUND_TEXT, handle FILE_NAME correctly, add Motif (CDE)
Jan Djärv <jan.h.d@swipnet.se>
parents:
53823
diff
changeset
|
581 (6 . XmDROP_FINISH) |
e83b3b3941cf
x-dnd.el: Add COMPOUND_TEXT, handle FILE_NAME correctly, add Motif (CDE)
Jan Djärv <jan.h.d@swipnet.se>
parents:
53823
diff
changeset
|
582 (7 . XmDRAG_DROP_FINISH) |
e83b3b3941cf
x-dnd.el: Add COMPOUND_TEXT, handle FILE_NAME correctly, add Motif (CDE)
Jan Djärv <jan.h.d@swipnet.se>
parents:
53823
diff
changeset
|
583 (8 . XmOPERATION_CHANGED)) |
e83b3b3941cf
x-dnd.el: Add COMPOUND_TEXT, handle FILE_NAME correctly, add Motif (CDE)
Jan Djärv <jan.h.d@swipnet.se>
parents:
53823
diff
changeset
|
584 "Mapping from numbers to Motif DND message types.") |
e83b3b3941cf
x-dnd.el: Add COMPOUND_TEXT, handle FILE_NAME correctly, add Motif (CDE)
Jan Djärv <jan.h.d@swipnet.se>
parents:
53823
diff
changeset
|
585 |
e83b3b3941cf
x-dnd.el: Add COMPOUND_TEXT, handle FILE_NAME correctly, add Motif (CDE)
Jan Djärv <jan.h.d@swipnet.se>
parents:
53823
diff
changeset
|
586 (defvar x-dnd-motif-to-action |
e83b3b3941cf
x-dnd.el: Add COMPOUND_TEXT, handle FILE_NAME correctly, add Motif (CDE)
Jan Djärv <jan.h.d@swipnet.se>
parents:
53823
diff
changeset
|
587 '((1 . move) |
e83b3b3941cf
x-dnd.el: Add COMPOUND_TEXT, handle FILE_NAME correctly, add Motif (CDE)
Jan Djärv <jan.h.d@swipnet.se>
parents:
53823
diff
changeset
|
588 (2 . copy) |
e83b3b3941cf
x-dnd.el: Add COMPOUND_TEXT, handle FILE_NAME correctly, add Motif (CDE)
Jan Djärv <jan.h.d@swipnet.se>
parents:
53823
diff
changeset
|
589 (3 . link) ; Both 3 and 4 has been seen as link. |
e83b3b3941cf
x-dnd.el: Add COMPOUND_TEXT, handle FILE_NAME correctly, add Motif (CDE)
Jan Djärv <jan.h.d@swipnet.se>
parents:
53823
diff
changeset
|
590 (4 . link) |
e83b3b3941cf
x-dnd.el: Add COMPOUND_TEXT, handle FILE_NAME correctly, add Motif (CDE)
Jan Djärv <jan.h.d@swipnet.se>
parents:
53823
diff
changeset
|
591 (2 . private)) ; Motif does not have private, so use copy for private. |
e83b3b3941cf
x-dnd.el: Add COMPOUND_TEXT, handle FILE_NAME correctly, add Motif (CDE)
Jan Djärv <jan.h.d@swipnet.se>
parents:
53823
diff
changeset
|
592 "Mapping from number to operation for Motif DND.") |
e83b3b3941cf
x-dnd.el: Add COMPOUND_TEXT, handle FILE_NAME correctly, add Motif (CDE)
Jan Djärv <jan.h.d@swipnet.se>
parents:
53823
diff
changeset
|
593 |
e83b3b3941cf
x-dnd.el: Add COMPOUND_TEXT, handle FILE_NAME correctly, add Motif (CDE)
Jan Djärv <jan.h.d@swipnet.se>
parents:
53823
diff
changeset
|
594 (defun x-dnd-handle-motif (event frame window message-atom format data) |
e83b3b3941cf
x-dnd.el: Add COMPOUND_TEXT, handle FILE_NAME correctly, add Motif (CDE)
Jan Djärv <jan.h.d@swipnet.se>
parents:
53823
diff
changeset
|
595 (let* ((message-type (cdr (assoc (aref data 0) x-dnd-motif-message-types))) |
e83b3b3941cf
x-dnd.el: Add COMPOUND_TEXT, handle FILE_NAME correctly, add Motif (CDE)
Jan Djärv <jan.h.d@swipnet.se>
parents:
53823
diff
changeset
|
596 (source-byteorder (aref data 1)) |
e83b3b3941cf
x-dnd.el: Add COMPOUND_TEXT, handle FILE_NAME correctly, add Motif (CDE)
Jan Djärv <jan.h.d@swipnet.se>
parents:
53823
diff
changeset
|
597 (my-byteorder (byteorder)) |
e83b3b3941cf
x-dnd.el: Add COMPOUND_TEXT, handle FILE_NAME correctly, add Motif (CDE)
Jan Djärv <jan.h.d@swipnet.se>
parents:
53823
diff
changeset
|
598 (source-flags (x-dnd-get-motif-value data 2 2 source-byteorder)) |
e83b3b3941cf
x-dnd.el: Add COMPOUND_TEXT, handle FILE_NAME correctly, add Motif (CDE)
Jan Djärv <jan.h.d@swipnet.se>
parents:
53823
diff
changeset
|
599 (source-action (cdr (assoc (logand ?\xF source-flags) |
e83b3b3941cf
x-dnd.el: Add COMPOUND_TEXT, handle FILE_NAME correctly, add Motif (CDE)
Jan Djärv <jan.h.d@swipnet.se>
parents:
53823
diff
changeset
|
600 x-dnd-motif-to-action)))) |
e83b3b3941cf
x-dnd.el: Add COMPOUND_TEXT, handle FILE_NAME correctly, add Motif (CDE)
Jan Djärv <jan.h.d@swipnet.se>
parents:
53823
diff
changeset
|
601 |
e83b3b3941cf
x-dnd.el: Add COMPOUND_TEXT, handle FILE_NAME correctly, add Motif (CDE)
Jan Djärv <jan.h.d@swipnet.se>
parents:
53823
diff
changeset
|
602 (cond ((eq message-type 'XmTOP_LEVEL_ENTER) |
e83b3b3941cf
x-dnd.el: Add COMPOUND_TEXT, handle FILE_NAME correctly, add Motif (CDE)
Jan Djärv <jan.h.d@swipnet.se>
parents:
53823
diff
changeset
|
603 (let* ((dnd-source (x-dnd-get-motif-value |
e83b3b3941cf
x-dnd.el: Add COMPOUND_TEXT, handle FILE_NAME correctly, add Motif (CDE)
Jan Djärv <jan.h.d@swipnet.se>
parents:
53823
diff
changeset
|
604 data 8 4 source-byteorder)) |
e83b3b3941cf
x-dnd.el: Add COMPOUND_TEXT, handle FILE_NAME correctly, add Motif (CDE)
Jan Djärv <jan.h.d@swipnet.se>
parents:
53823
diff
changeset
|
605 (selection-atom (x-dnd-get-motif-value |
e83b3b3941cf
x-dnd.el: Add COMPOUND_TEXT, handle FILE_NAME correctly, add Motif (CDE)
Jan Djärv <jan.h.d@swipnet.se>
parents:
53823
diff
changeset
|
606 data 12 4 source-byteorder)) |
e83b3b3941cf
x-dnd.el: Add COMPOUND_TEXT, handle FILE_NAME correctly, add Motif (CDE)
Jan Djärv <jan.h.d@swipnet.se>
parents:
53823
diff
changeset
|
607 (atom-name (x-get-atom-name selection-atom)) |
e83b3b3941cf
x-dnd.el: Add COMPOUND_TEXT, handle FILE_NAME correctly, add Motif (CDE)
Jan Djärv <jan.h.d@swipnet.se>
parents:
53823
diff
changeset
|
608 (types (when atom-name |
e83b3b3941cf
x-dnd.el: Add COMPOUND_TEXT, handle FILE_NAME correctly, add Motif (CDE)
Jan Djärv <jan.h.d@swipnet.se>
parents:
53823
diff
changeset
|
609 (x-get-selection-internal (intern atom-name) |
e83b3b3941cf
x-dnd.el: Add COMPOUND_TEXT, handle FILE_NAME correctly, add Motif (CDE)
Jan Djärv <jan.h.d@swipnet.se>
parents:
53823
diff
changeset
|
610 'TARGETS)))) |
e83b3b3941cf
x-dnd.el: Add COMPOUND_TEXT, handle FILE_NAME correctly, add Motif (CDE)
Jan Djärv <jan.h.d@swipnet.se>
parents:
53823
diff
changeset
|
611 (x-dnd-forget-drop frame) |
e83b3b3941cf
x-dnd.el: Add COMPOUND_TEXT, handle FILE_NAME correctly, add Motif (CDE)
Jan Djärv <jan.h.d@swipnet.se>
parents:
53823
diff
changeset
|
612 (when types (x-dnd-save-state window nil nil |
e83b3b3941cf
x-dnd.el: Add COMPOUND_TEXT, handle FILE_NAME correctly, add Motif (CDE)
Jan Djärv <jan.h.d@swipnet.se>
parents:
53823
diff
changeset
|
613 types |
e83b3b3941cf
x-dnd.el: Add COMPOUND_TEXT, handle FILE_NAME correctly, add Motif (CDE)
Jan Djärv <jan.h.d@swipnet.se>
parents:
53823
diff
changeset
|
614 dnd-source)))) |
e83b3b3941cf
x-dnd.el: Add COMPOUND_TEXT, handle FILE_NAME correctly, add Motif (CDE)
Jan Djärv <jan.h.d@swipnet.se>
parents:
53823
diff
changeset
|
615 |
e83b3b3941cf
x-dnd.el: Add COMPOUND_TEXT, handle FILE_NAME correctly, add Motif (CDE)
Jan Djärv <jan.h.d@swipnet.se>
parents:
53823
diff
changeset
|
616 ;; Can not forget drop here, LEAVE comes before DROP_START and |
e83b3b3941cf
x-dnd.el: Add COMPOUND_TEXT, handle FILE_NAME correctly, add Motif (CDE)
Jan Djärv <jan.h.d@swipnet.se>
parents:
53823
diff
changeset
|
617 ;; we need the state in DROP_START. |
e83b3b3941cf
x-dnd.el: Add COMPOUND_TEXT, handle FILE_NAME correctly, add Motif (CDE)
Jan Djärv <jan.h.d@swipnet.se>
parents:
53823
diff
changeset
|
618 ((eq message-type 'XmTOP_LEVEL_LEAVE) |
e83b3b3941cf
x-dnd.el: Add COMPOUND_TEXT, handle FILE_NAME correctly, add Motif (CDE)
Jan Djärv <jan.h.d@swipnet.se>
parents:
53823
diff
changeset
|
619 nil) |
e83b3b3941cf
x-dnd.el: Add COMPOUND_TEXT, handle FILE_NAME correctly, add Motif (CDE)
Jan Djärv <jan.h.d@swipnet.se>
parents:
53823
diff
changeset
|
620 |
e83b3b3941cf
x-dnd.el: Add COMPOUND_TEXT, handle FILE_NAME correctly, add Motif (CDE)
Jan Djärv <jan.h.d@swipnet.se>
parents:
53823
diff
changeset
|
621 ((eq message-type 'XmDRAG_MOTION) |
e83b3b3941cf
x-dnd.el: Add COMPOUND_TEXT, handle FILE_NAME correctly, add Motif (CDE)
Jan Djärv <jan.h.d@swipnet.se>
parents:
53823
diff
changeset
|
622 (let* ((state (x-dnd-get-state-for-frame frame)) |
e83b3b3941cf
x-dnd.el: Add COMPOUND_TEXT, handle FILE_NAME correctly, add Motif (CDE)
Jan Djärv <jan.h.d@swipnet.se>
parents:
53823
diff
changeset
|
623 (timestamp (x-dnd-motif-value-to-list |
59996
aac0a33f5772
Change release version from 21.4 to 22.1 throughout.
Kim F. Storm <storm@cua.dk>
parents:
59932
diff
changeset
|
624 (x-dnd-get-motif-value data 4 4 |
53913
e83b3b3941cf
x-dnd.el: Add COMPOUND_TEXT, handle FILE_NAME correctly, add Motif (CDE)
Jan Djärv <jan.h.d@swipnet.se>
parents:
53823
diff
changeset
|
625 source-byteorder) |
e83b3b3941cf
x-dnd.el: Add COMPOUND_TEXT, handle FILE_NAME correctly, add Motif (CDE)
Jan Djärv <jan.h.d@swipnet.se>
parents:
53823
diff
changeset
|
626 4 my-byteorder)) |
e83b3b3941cf
x-dnd.el: Add COMPOUND_TEXT, handle FILE_NAME correctly, add Motif (CDE)
Jan Djärv <jan.h.d@swipnet.se>
parents:
53823
diff
changeset
|
627 (x (x-dnd-motif-value-to-list |
e83b3b3941cf
x-dnd.el: Add COMPOUND_TEXT, handle FILE_NAME correctly, add Motif (CDE)
Jan Djärv <jan.h.d@swipnet.se>
parents:
53823
diff
changeset
|
628 (x-dnd-get-motif-value data 8 2 source-byteorder) |
e83b3b3941cf
x-dnd.el: Add COMPOUND_TEXT, handle FILE_NAME correctly, add Motif (CDE)
Jan Djärv <jan.h.d@swipnet.se>
parents:
53823
diff
changeset
|
629 2 my-byteorder)) |
e83b3b3941cf
x-dnd.el: Add COMPOUND_TEXT, handle FILE_NAME correctly, add Motif (CDE)
Jan Djärv <jan.h.d@swipnet.se>
parents:
53823
diff
changeset
|
630 (y (x-dnd-motif-value-to-list |
e83b3b3941cf
x-dnd.el: Add COMPOUND_TEXT, handle FILE_NAME correctly, add Motif (CDE)
Jan Djärv <jan.h.d@swipnet.se>
parents:
53823
diff
changeset
|
631 (x-dnd-get-motif-value data 10 2 source-byteorder) |
e83b3b3941cf
x-dnd.el: Add COMPOUND_TEXT, handle FILE_NAME correctly, add Motif (CDE)
Jan Djärv <jan.h.d@swipnet.se>
parents:
53823
diff
changeset
|
632 2 my-byteorder)) |
e83b3b3941cf
x-dnd.el: Add COMPOUND_TEXT, handle FILE_NAME correctly, add Motif (CDE)
Jan Djärv <jan.h.d@swipnet.se>
parents:
53823
diff
changeset
|
633 (dnd-source (aref state 6)) |
e83b3b3941cf
x-dnd.el: Add COMPOUND_TEXT, handle FILE_NAME correctly, add Motif (CDE)
Jan Djärv <jan.h.d@swipnet.se>
parents:
53823
diff
changeset
|
634 (first-move (not (aref state 3))) |
e83b3b3941cf
x-dnd.el: Add COMPOUND_TEXT, handle FILE_NAME correctly, add Motif (CDE)
Jan Djärv <jan.h.d@swipnet.se>
parents:
53823
diff
changeset
|
635 (action-type (x-dnd-maybe-call-test-function |
e83b3b3941cf
x-dnd.el: Add COMPOUND_TEXT, handle FILE_NAME correctly, add Motif (CDE)
Jan Djärv <jan.h.d@swipnet.se>
parents:
53823
diff
changeset
|
636 window |
e83b3b3941cf
x-dnd.el: Add COMPOUND_TEXT, handle FILE_NAME correctly, add Motif (CDE)
Jan Djärv <jan.h.d@swipnet.se>
parents:
53823
diff
changeset
|
637 source-action)) |
e83b3b3941cf
x-dnd.el: Add COMPOUND_TEXT, handle FILE_NAME correctly, add Motif (CDE)
Jan Djärv <jan.h.d@swipnet.se>
parents:
53823
diff
changeset
|
638 (reply-action (car (rassoc (car action-type) |
e83b3b3941cf
x-dnd.el: Add COMPOUND_TEXT, handle FILE_NAME correctly, add Motif (CDE)
Jan Djärv <jan.h.d@swipnet.se>
parents:
53823
diff
changeset
|
639 x-dnd-motif-to-action))) |
e83b3b3941cf
x-dnd.el: Add COMPOUND_TEXT, handle FILE_NAME correctly, add Motif (CDE)
Jan Djärv <jan.h.d@swipnet.se>
parents:
53823
diff
changeset
|
640 (reply-flags |
e83b3b3941cf
x-dnd.el: Add COMPOUND_TEXT, handle FILE_NAME correctly, add Motif (CDE)
Jan Djärv <jan.h.d@swipnet.se>
parents:
53823
diff
changeset
|
641 (x-dnd-motif-value-to-list |
e83b3b3941cf
x-dnd.el: Add COMPOUND_TEXT, handle FILE_NAME correctly, add Motif (CDE)
Jan Djärv <jan.h.d@swipnet.se>
parents:
53823
diff
changeset
|
642 (if reply-action |
59996
aac0a33f5772
Change release version from 21.4 to 22.1 throughout.
Kim F. Storm <storm@cua.dk>
parents:
59932
diff
changeset
|
643 (+ reply-action |
53913
e83b3b3941cf
x-dnd.el: Add COMPOUND_TEXT, handle FILE_NAME correctly, add Motif (CDE)
Jan Djärv <jan.h.d@swipnet.se>
parents:
53823
diff
changeset
|
644 ?\x30 ; 30: valid drop site |
e83b3b3941cf
x-dnd.el: Add COMPOUND_TEXT, handle FILE_NAME correctly, add Motif (CDE)
Jan Djärv <jan.h.d@swipnet.se>
parents:
53823
diff
changeset
|
645 ?\x700) ; 700: can do copy, move or link |
e83b3b3941cf
x-dnd.el: Add COMPOUND_TEXT, handle FILE_NAME correctly, add Motif (CDE)
Jan Djärv <jan.h.d@swipnet.se>
parents:
53823
diff
changeset
|
646 ?\x30) ; 30: drop site, but noop. |
e83b3b3941cf
x-dnd.el: Add COMPOUND_TEXT, handle FILE_NAME correctly, add Motif (CDE)
Jan Djärv <jan.h.d@swipnet.se>
parents:
53823
diff
changeset
|
647 2 my-byteorder)) |
e83b3b3941cf
x-dnd.el: Add COMPOUND_TEXT, handle FILE_NAME correctly, add Motif (CDE)
Jan Djärv <jan.h.d@swipnet.se>
parents:
53823
diff
changeset
|
648 (reply (append |
e83b3b3941cf
x-dnd.el: Add COMPOUND_TEXT, handle FILE_NAME correctly, add Motif (CDE)
Jan Djärv <jan.h.d@swipnet.se>
parents:
53823
diff
changeset
|
649 (list |
e83b3b3941cf
x-dnd.el: Add COMPOUND_TEXT, handle FILE_NAME correctly, add Motif (CDE)
Jan Djärv <jan.h.d@swipnet.se>
parents:
53823
diff
changeset
|
650 (+ ?\x80 ; 0x80 indicates a reply. |
e83b3b3941cf
x-dnd.el: Add COMPOUND_TEXT, handle FILE_NAME correctly, add Motif (CDE)
Jan Djärv <jan.h.d@swipnet.se>
parents:
53823
diff
changeset
|
651 (if first-move |
e83b3b3941cf
x-dnd.el: Add COMPOUND_TEXT, handle FILE_NAME correctly, add Motif (CDE)
Jan Djärv <jan.h.d@swipnet.se>
parents:
53823
diff
changeset
|
652 3 ; First time, reply is SITE_ENTER. |
e83b3b3941cf
x-dnd.el: Add COMPOUND_TEXT, handle FILE_NAME correctly, add Motif (CDE)
Jan Djärv <jan.h.d@swipnet.se>
parents:
53823
diff
changeset
|
653 2)) ; Not first time, reply is DRAG_MOTION. |
e83b3b3941cf
x-dnd.el: Add COMPOUND_TEXT, handle FILE_NAME correctly, add Motif (CDE)
Jan Djärv <jan.h.d@swipnet.se>
parents:
53823
diff
changeset
|
654 my-byteorder) |
e83b3b3941cf
x-dnd.el: Add COMPOUND_TEXT, handle FILE_NAME correctly, add Motif (CDE)
Jan Djärv <jan.h.d@swipnet.se>
parents:
53823
diff
changeset
|
655 reply-flags |
e83b3b3941cf
x-dnd.el: Add COMPOUND_TEXT, handle FILE_NAME correctly, add Motif (CDE)
Jan Djärv <jan.h.d@swipnet.se>
parents:
53823
diff
changeset
|
656 timestamp |
e83b3b3941cf
x-dnd.el: Add COMPOUND_TEXT, handle FILE_NAME correctly, add Motif (CDE)
Jan Djärv <jan.h.d@swipnet.se>
parents:
53823
diff
changeset
|
657 x |
e83b3b3941cf
x-dnd.el: Add COMPOUND_TEXT, handle FILE_NAME correctly, add Motif (CDE)
Jan Djärv <jan.h.d@swipnet.se>
parents:
53823
diff
changeset
|
658 y))) |
e83b3b3941cf
x-dnd.el: Add COMPOUND_TEXT, handle FILE_NAME correctly, add Motif (CDE)
Jan Djärv <jan.h.d@swipnet.se>
parents:
53823
diff
changeset
|
659 (x-send-client-message frame |
e83b3b3941cf
x-dnd.el: Add COMPOUND_TEXT, handle FILE_NAME correctly, add Motif (CDE)
Jan Djärv <jan.h.d@swipnet.se>
parents:
53823
diff
changeset
|
660 dnd-source |
e83b3b3941cf
x-dnd.el: Add COMPOUND_TEXT, handle FILE_NAME correctly, add Motif (CDE)
Jan Djärv <jan.h.d@swipnet.se>
parents:
53823
diff
changeset
|
661 frame |
e83b3b3941cf
x-dnd.el: Add COMPOUND_TEXT, handle FILE_NAME correctly, add Motif (CDE)
Jan Djärv <jan.h.d@swipnet.se>
parents:
53823
diff
changeset
|
662 "_MOTIF_DRAG_AND_DROP_MESSAGE" |
e83b3b3941cf
x-dnd.el: Add COMPOUND_TEXT, handle FILE_NAME correctly, add Motif (CDE)
Jan Djärv <jan.h.d@swipnet.se>
parents:
53823
diff
changeset
|
663 8 |
e83b3b3941cf
x-dnd.el: Add COMPOUND_TEXT, handle FILE_NAME correctly, add Motif (CDE)
Jan Djärv <jan.h.d@swipnet.se>
parents:
53823
diff
changeset
|
664 reply))) |
e83b3b3941cf
x-dnd.el: Add COMPOUND_TEXT, handle FILE_NAME correctly, add Motif (CDE)
Jan Djärv <jan.h.d@swipnet.se>
parents:
53823
diff
changeset
|
665 |
e83b3b3941cf
x-dnd.el: Add COMPOUND_TEXT, handle FILE_NAME correctly, add Motif (CDE)
Jan Djärv <jan.h.d@swipnet.se>
parents:
53823
diff
changeset
|
666 ((eq message-type 'XmOPERATION_CHANGED) |
e83b3b3941cf
x-dnd.el: Add COMPOUND_TEXT, handle FILE_NAME correctly, add Motif (CDE)
Jan Djärv <jan.h.d@swipnet.se>
parents:
53823
diff
changeset
|
667 (let* ((state (x-dnd-get-state-for-frame frame)) |
e83b3b3941cf
x-dnd.el: Add COMPOUND_TEXT, handle FILE_NAME correctly, add Motif (CDE)
Jan Djärv <jan.h.d@swipnet.se>
parents:
53823
diff
changeset
|
668 (timestamp (x-dnd-motif-value-to-list |
e83b3b3941cf
x-dnd.el: Add COMPOUND_TEXT, handle FILE_NAME correctly, add Motif (CDE)
Jan Djärv <jan.h.d@swipnet.se>
parents:
53823
diff
changeset
|
669 (x-dnd-get-motif-value data 4 4 source-byteorder) |
e83b3b3941cf
x-dnd.el: Add COMPOUND_TEXT, handle FILE_NAME correctly, add Motif (CDE)
Jan Djärv <jan.h.d@swipnet.se>
parents:
53823
diff
changeset
|
670 4 my-byteorder)) |
e83b3b3941cf
x-dnd.el: Add COMPOUND_TEXT, handle FILE_NAME correctly, add Motif (CDE)
Jan Djärv <jan.h.d@swipnet.se>
parents:
53823
diff
changeset
|
671 (dnd-source (aref state 6)) |
e83b3b3941cf
x-dnd.el: Add COMPOUND_TEXT, handle FILE_NAME correctly, add Motif (CDE)
Jan Djärv <jan.h.d@swipnet.se>
parents:
53823
diff
changeset
|
672 (action-type (x-dnd-maybe-call-test-function |
e83b3b3941cf
x-dnd.el: Add COMPOUND_TEXT, handle FILE_NAME correctly, add Motif (CDE)
Jan Djärv <jan.h.d@swipnet.se>
parents:
53823
diff
changeset
|
673 window |
e83b3b3941cf
x-dnd.el: Add COMPOUND_TEXT, handle FILE_NAME correctly, add Motif (CDE)
Jan Djärv <jan.h.d@swipnet.se>
parents:
53823
diff
changeset
|
674 source-action)) |
e83b3b3941cf
x-dnd.el: Add COMPOUND_TEXT, handle FILE_NAME correctly, add Motif (CDE)
Jan Djärv <jan.h.d@swipnet.se>
parents:
53823
diff
changeset
|
675 (reply-action (car (rassoc (car action-type) |
e83b3b3941cf
x-dnd.el: Add COMPOUND_TEXT, handle FILE_NAME correctly, add Motif (CDE)
Jan Djärv <jan.h.d@swipnet.se>
parents:
53823
diff
changeset
|
676 x-dnd-motif-to-action))) |
e83b3b3941cf
x-dnd.el: Add COMPOUND_TEXT, handle FILE_NAME correctly, add Motif (CDE)
Jan Djärv <jan.h.d@swipnet.se>
parents:
53823
diff
changeset
|
677 (reply-flags |
e83b3b3941cf
x-dnd.el: Add COMPOUND_TEXT, handle FILE_NAME correctly, add Motif (CDE)
Jan Djärv <jan.h.d@swipnet.se>
parents:
53823
diff
changeset
|
678 (x-dnd-motif-value-to-list |
e83b3b3941cf
x-dnd.el: Add COMPOUND_TEXT, handle FILE_NAME correctly, add Motif (CDE)
Jan Djärv <jan.h.d@swipnet.se>
parents:
53823
diff
changeset
|
679 (if reply-action |
59996
aac0a33f5772
Change release version from 21.4 to 22.1 throughout.
Kim F. Storm <storm@cua.dk>
parents:
59932
diff
changeset
|
680 (+ reply-action |
53913
e83b3b3941cf
x-dnd.el: Add COMPOUND_TEXT, handle FILE_NAME correctly, add Motif (CDE)
Jan Djärv <jan.h.d@swipnet.se>
parents:
53823
diff
changeset
|
681 ?\x30 ; 30: valid drop site |
e83b3b3941cf
x-dnd.el: Add COMPOUND_TEXT, handle FILE_NAME correctly, add Motif (CDE)
Jan Djärv <jan.h.d@swipnet.se>
parents:
53823
diff
changeset
|
682 ?\x700) ; 700: can do copy, move or link |
e83b3b3941cf
x-dnd.el: Add COMPOUND_TEXT, handle FILE_NAME correctly, add Motif (CDE)
Jan Djärv <jan.h.d@swipnet.se>
parents:
53823
diff
changeset
|
683 ?\x30) ; 30: drop site, but noop |
e83b3b3941cf
x-dnd.el: Add COMPOUND_TEXT, handle FILE_NAME correctly, add Motif (CDE)
Jan Djärv <jan.h.d@swipnet.se>
parents:
53823
diff
changeset
|
684 2 my-byteorder)) |
e83b3b3941cf
x-dnd.el: Add COMPOUND_TEXT, handle FILE_NAME correctly, add Motif (CDE)
Jan Djärv <jan.h.d@swipnet.se>
parents:
53823
diff
changeset
|
685 (reply (append |
e83b3b3941cf
x-dnd.el: Add COMPOUND_TEXT, handle FILE_NAME correctly, add Motif (CDE)
Jan Djärv <jan.h.d@swipnet.se>
parents:
53823
diff
changeset
|
686 (list |
e83b3b3941cf
x-dnd.el: Add COMPOUND_TEXT, handle FILE_NAME correctly, add Motif (CDE)
Jan Djärv <jan.h.d@swipnet.se>
parents:
53823
diff
changeset
|
687 (+ ?\x80 ; 0x80 indicates a reply. |
e83b3b3941cf
x-dnd.el: Add COMPOUND_TEXT, handle FILE_NAME correctly, add Motif (CDE)
Jan Djärv <jan.h.d@swipnet.se>
parents:
53823
diff
changeset
|
688 8) ; 8 is OPERATION_CHANGED |
e83b3b3941cf
x-dnd.el: Add COMPOUND_TEXT, handle FILE_NAME correctly, add Motif (CDE)
Jan Djärv <jan.h.d@swipnet.se>
parents:
53823
diff
changeset
|
689 my-byteorder) |
e83b3b3941cf
x-dnd.el: Add COMPOUND_TEXT, handle FILE_NAME correctly, add Motif (CDE)
Jan Djärv <jan.h.d@swipnet.se>
parents:
53823
diff
changeset
|
690 reply-flags |
e83b3b3941cf
x-dnd.el: Add COMPOUND_TEXT, handle FILE_NAME correctly, add Motif (CDE)
Jan Djärv <jan.h.d@swipnet.se>
parents:
53823
diff
changeset
|
691 timestamp))) |
e83b3b3941cf
x-dnd.el: Add COMPOUND_TEXT, handle FILE_NAME correctly, add Motif (CDE)
Jan Djärv <jan.h.d@swipnet.se>
parents:
53823
diff
changeset
|
692 (x-send-client-message frame |
e83b3b3941cf
x-dnd.el: Add COMPOUND_TEXT, handle FILE_NAME correctly, add Motif (CDE)
Jan Djärv <jan.h.d@swipnet.se>
parents:
53823
diff
changeset
|
693 dnd-source |
e83b3b3941cf
x-dnd.el: Add COMPOUND_TEXT, handle FILE_NAME correctly, add Motif (CDE)
Jan Djärv <jan.h.d@swipnet.se>
parents:
53823
diff
changeset
|
694 frame |
e83b3b3941cf
x-dnd.el: Add COMPOUND_TEXT, handle FILE_NAME correctly, add Motif (CDE)
Jan Djärv <jan.h.d@swipnet.se>
parents:
53823
diff
changeset
|
695 "_MOTIF_DRAG_AND_DROP_MESSAGE" |
e83b3b3941cf
x-dnd.el: Add COMPOUND_TEXT, handle FILE_NAME correctly, add Motif (CDE)
Jan Djärv <jan.h.d@swipnet.se>
parents:
53823
diff
changeset
|
696 8 |
e83b3b3941cf
x-dnd.el: Add COMPOUND_TEXT, handle FILE_NAME correctly, add Motif (CDE)
Jan Djärv <jan.h.d@swipnet.se>
parents:
53823
diff
changeset
|
697 reply))) |
e83b3b3941cf
x-dnd.el: Add COMPOUND_TEXT, handle FILE_NAME correctly, add Motif (CDE)
Jan Djärv <jan.h.d@swipnet.se>
parents:
53823
diff
changeset
|
698 |
e83b3b3941cf
x-dnd.el: Add COMPOUND_TEXT, handle FILE_NAME correctly, add Motif (CDE)
Jan Djärv <jan.h.d@swipnet.se>
parents:
53823
diff
changeset
|
699 ((eq message-type 'XmDROP_START) |
e83b3b3941cf
x-dnd.el: Add COMPOUND_TEXT, handle FILE_NAME correctly, add Motif (CDE)
Jan Djärv <jan.h.d@swipnet.se>
parents:
53823
diff
changeset
|
700 (let* ((x (x-dnd-motif-value-to-list |
e83b3b3941cf
x-dnd.el: Add COMPOUND_TEXT, handle FILE_NAME correctly, add Motif (CDE)
Jan Djärv <jan.h.d@swipnet.se>
parents:
53823
diff
changeset
|
701 (x-dnd-get-motif-value data 8 2 source-byteorder) |
e83b3b3941cf
x-dnd.el: Add COMPOUND_TEXT, handle FILE_NAME correctly, add Motif (CDE)
Jan Djärv <jan.h.d@swipnet.se>
parents:
53823
diff
changeset
|
702 2 my-byteorder)) |
e83b3b3941cf
x-dnd.el: Add COMPOUND_TEXT, handle FILE_NAME correctly, add Motif (CDE)
Jan Djärv <jan.h.d@swipnet.se>
parents:
53823
diff
changeset
|
703 (y (x-dnd-motif-value-to-list |
e83b3b3941cf
x-dnd.el: Add COMPOUND_TEXT, handle FILE_NAME correctly, add Motif (CDE)
Jan Djärv <jan.h.d@swipnet.se>
parents:
53823
diff
changeset
|
704 (x-dnd-get-motif-value data 10 2 source-byteorder) |
e83b3b3941cf
x-dnd.el: Add COMPOUND_TEXT, handle FILE_NAME correctly, add Motif (CDE)
Jan Djärv <jan.h.d@swipnet.se>
parents:
53823
diff
changeset
|
705 2 my-byteorder)) |
e83b3b3941cf
x-dnd.el: Add COMPOUND_TEXT, handle FILE_NAME correctly, add Motif (CDE)
Jan Djärv <jan.h.d@swipnet.se>
parents:
53823
diff
changeset
|
706 (selection-atom (x-dnd-get-motif-value |
e83b3b3941cf
x-dnd.el: Add COMPOUND_TEXT, handle FILE_NAME correctly, add Motif (CDE)
Jan Djärv <jan.h.d@swipnet.se>
parents:
53823
diff
changeset
|
707 data 12 4 source-byteorder)) |
e83b3b3941cf
x-dnd.el: Add COMPOUND_TEXT, handle FILE_NAME correctly, add Motif (CDE)
Jan Djärv <jan.h.d@swipnet.se>
parents:
53823
diff
changeset
|
708 (atom-name (x-get-atom-name selection-atom)) |
e83b3b3941cf
x-dnd.el: Add COMPOUND_TEXT, handle FILE_NAME correctly, add Motif (CDE)
Jan Djärv <jan.h.d@swipnet.se>
parents:
53823
diff
changeset
|
709 (dnd-source (x-dnd-get-motif-value |
e83b3b3941cf
x-dnd.el: Add COMPOUND_TEXT, handle FILE_NAME correctly, add Motif (CDE)
Jan Djärv <jan.h.d@swipnet.se>
parents:
53823
diff
changeset
|
710 data 16 4 source-byteorder)) |
e83b3b3941cf
x-dnd.el: Add COMPOUND_TEXT, handle FILE_NAME correctly, add Motif (CDE)
Jan Djärv <jan.h.d@swipnet.se>
parents:
53823
diff
changeset
|
711 (action-type (x-dnd-maybe-call-test-function |
e83b3b3941cf
x-dnd.el: Add COMPOUND_TEXT, handle FILE_NAME correctly, add Motif (CDE)
Jan Djärv <jan.h.d@swipnet.se>
parents:
53823
diff
changeset
|
712 window |
e83b3b3941cf
x-dnd.el: Add COMPOUND_TEXT, handle FILE_NAME correctly, add Motif (CDE)
Jan Djärv <jan.h.d@swipnet.se>
parents:
53823
diff
changeset
|
713 source-action)) |
e83b3b3941cf
x-dnd.el: Add COMPOUND_TEXT, handle FILE_NAME correctly, add Motif (CDE)
Jan Djärv <jan.h.d@swipnet.se>
parents:
53823
diff
changeset
|
714 (reply-action (car (rassoc (car action-type) |
e83b3b3941cf
x-dnd.el: Add COMPOUND_TEXT, handle FILE_NAME correctly, add Motif (CDE)
Jan Djärv <jan.h.d@swipnet.se>
parents:
53823
diff
changeset
|
715 x-dnd-motif-to-action))) |
e83b3b3941cf
x-dnd.el: Add COMPOUND_TEXT, handle FILE_NAME correctly, add Motif (CDE)
Jan Djärv <jan.h.d@swipnet.se>
parents:
53823
diff
changeset
|
716 (reply-flags |
e83b3b3941cf
x-dnd.el: Add COMPOUND_TEXT, handle FILE_NAME correctly, add Motif (CDE)
Jan Djärv <jan.h.d@swipnet.se>
parents:
53823
diff
changeset
|
717 (x-dnd-motif-value-to-list |
e83b3b3941cf
x-dnd.el: Add COMPOUND_TEXT, handle FILE_NAME correctly, add Motif (CDE)
Jan Djärv <jan.h.d@swipnet.se>
parents:
53823
diff
changeset
|
718 (if reply-action |
59996
aac0a33f5772
Change release version from 21.4 to 22.1 throughout.
Kim F. Storm <storm@cua.dk>
parents:
59932
diff
changeset
|
719 (+ reply-action |
53913
e83b3b3941cf
x-dnd.el: Add COMPOUND_TEXT, handle FILE_NAME correctly, add Motif (CDE)
Jan Djärv <jan.h.d@swipnet.se>
parents:
53823
diff
changeset
|
720 ?\x30 ; 30: valid drop site |
e83b3b3941cf
x-dnd.el: Add COMPOUND_TEXT, handle FILE_NAME correctly, add Motif (CDE)
Jan Djärv <jan.h.d@swipnet.se>
parents:
53823
diff
changeset
|
721 ?\x700) ; 700: can do copy, move or link |
e83b3b3941cf
x-dnd.el: Add COMPOUND_TEXT, handle FILE_NAME correctly, add Motif (CDE)
Jan Djärv <jan.h.d@swipnet.se>
parents:
53823
diff
changeset
|
722 (+ ?\x30 ; 30: drop site, but noop. |
e83b3b3941cf
x-dnd.el: Add COMPOUND_TEXT, handle FILE_NAME correctly, add Motif (CDE)
Jan Djärv <jan.h.d@swipnet.se>
parents:
53823
diff
changeset
|
723 ?\x200)) ; 200: drop cancel. |
e83b3b3941cf
x-dnd.el: Add COMPOUND_TEXT, handle FILE_NAME correctly, add Motif (CDE)
Jan Djärv <jan.h.d@swipnet.se>
parents:
53823
diff
changeset
|
724 2 my-byteorder)) |
e83b3b3941cf
x-dnd.el: Add COMPOUND_TEXT, handle FILE_NAME correctly, add Motif (CDE)
Jan Djärv <jan.h.d@swipnet.se>
parents:
53823
diff
changeset
|
725 (reply (append |
e83b3b3941cf
x-dnd.el: Add COMPOUND_TEXT, handle FILE_NAME correctly, add Motif (CDE)
Jan Djärv <jan.h.d@swipnet.se>
parents:
53823
diff
changeset
|
726 (list |
e83b3b3941cf
x-dnd.el: Add COMPOUND_TEXT, handle FILE_NAME correctly, add Motif (CDE)
Jan Djärv <jan.h.d@swipnet.se>
parents:
53823
diff
changeset
|
727 (+ ?\x80 ; 0x80 indicates a reply. |
e83b3b3941cf
x-dnd.el: Add COMPOUND_TEXT, handle FILE_NAME correctly, add Motif (CDE)
Jan Djärv <jan.h.d@swipnet.se>
parents:
53823
diff
changeset
|
728 5) ; DROP_START. |
e83b3b3941cf
x-dnd.el: Add COMPOUND_TEXT, handle FILE_NAME correctly, add Motif (CDE)
Jan Djärv <jan.h.d@swipnet.se>
parents:
53823
diff
changeset
|
729 my-byteorder) |
e83b3b3941cf
x-dnd.el: Add COMPOUND_TEXT, handle FILE_NAME correctly, add Motif (CDE)
Jan Djärv <jan.h.d@swipnet.se>
parents:
53823
diff
changeset
|
730 reply-flags |
e83b3b3941cf
x-dnd.el: Add COMPOUND_TEXT, handle FILE_NAME correctly, add Motif (CDE)
Jan Djärv <jan.h.d@swipnet.se>
parents:
53823
diff
changeset
|
731 x |
e83b3b3941cf
x-dnd.el: Add COMPOUND_TEXT, handle FILE_NAME correctly, add Motif (CDE)
Jan Djärv <jan.h.d@swipnet.se>
parents:
53823
diff
changeset
|
732 y)) |
59996
aac0a33f5772
Change release version from 21.4 to 22.1 throughout.
Kim F. Storm <storm@cua.dk>
parents:
59932
diff
changeset
|
733 (timestamp (x-dnd-get-motif-value |
53913
e83b3b3941cf
x-dnd.el: Add COMPOUND_TEXT, handle FILE_NAME correctly, add Motif (CDE)
Jan Djärv <jan.h.d@swipnet.se>
parents:
53823
diff
changeset
|
734 data 4 4 source-byteorder)) |
e83b3b3941cf
x-dnd.el: Add COMPOUND_TEXT, handle FILE_NAME correctly, add Motif (CDE)
Jan Djärv <jan.h.d@swipnet.se>
parents:
53823
diff
changeset
|
735 action) |
e83b3b3941cf
x-dnd.el: Add COMPOUND_TEXT, handle FILE_NAME correctly, add Motif (CDE)
Jan Djärv <jan.h.d@swipnet.se>
parents:
53823
diff
changeset
|
736 |
e83b3b3941cf
x-dnd.el: Add COMPOUND_TEXT, handle FILE_NAME correctly, add Motif (CDE)
Jan Djärv <jan.h.d@swipnet.se>
parents:
53823
diff
changeset
|
737 (x-send-client-message frame |
e83b3b3941cf
x-dnd.el: Add COMPOUND_TEXT, handle FILE_NAME correctly, add Motif (CDE)
Jan Djärv <jan.h.d@swipnet.se>
parents:
53823
diff
changeset
|
738 dnd-source |
e83b3b3941cf
x-dnd.el: Add COMPOUND_TEXT, handle FILE_NAME correctly, add Motif (CDE)
Jan Djärv <jan.h.d@swipnet.se>
parents:
53823
diff
changeset
|
739 frame |
e83b3b3941cf
x-dnd.el: Add COMPOUND_TEXT, handle FILE_NAME correctly, add Motif (CDE)
Jan Djärv <jan.h.d@swipnet.se>
parents:
53823
diff
changeset
|
740 "_MOTIF_DRAG_AND_DROP_MESSAGE" |
e83b3b3941cf
x-dnd.el: Add COMPOUND_TEXT, handle FILE_NAME correctly, add Motif (CDE)
Jan Djärv <jan.h.d@swipnet.se>
parents:
53823
diff
changeset
|
741 8 |
e83b3b3941cf
x-dnd.el: Add COMPOUND_TEXT, handle FILE_NAME correctly, add Motif (CDE)
Jan Djärv <jan.h.d@swipnet.se>
parents:
53823
diff
changeset
|
742 reply) |
59996
aac0a33f5772
Change release version from 21.4 to 22.1 throughout.
Kim F. Storm <storm@cua.dk>
parents:
59932
diff
changeset
|
743 (setq action |
53913
e83b3b3941cf
x-dnd.el: Add COMPOUND_TEXT, handle FILE_NAME correctly, add Motif (CDE)
Jan Djärv <jan.h.d@swipnet.se>
parents:
53823
diff
changeset
|
744 (when (and reply-action atom-name) |
e83b3b3941cf
x-dnd.el: Add COMPOUND_TEXT, handle FILE_NAME correctly, add Motif (CDE)
Jan Djärv <jan.h.d@swipnet.se>
parents:
53823
diff
changeset
|
745 (let* ((value (x-get-selection-internal |
e83b3b3941cf
x-dnd.el: Add COMPOUND_TEXT, handle FILE_NAME correctly, add Motif (CDE)
Jan Djärv <jan.h.d@swipnet.se>
parents:
53823
diff
changeset
|
746 (intern atom-name) |
e83b3b3941cf
x-dnd.el: Add COMPOUND_TEXT, handle FILE_NAME correctly, add Motif (CDE)
Jan Djärv <jan.h.d@swipnet.se>
parents:
53823
diff
changeset
|
747 (intern (x-dnd-current-type window))))) |
e83b3b3941cf
x-dnd.el: Add COMPOUND_TEXT, handle FILE_NAME correctly, add Motif (CDE)
Jan Djärv <jan.h.d@swipnet.se>
parents:
53823
diff
changeset
|
748 (when value |
e83b3b3941cf
x-dnd.el: Add COMPOUND_TEXT, handle FILE_NAME correctly, add Motif (CDE)
Jan Djärv <jan.h.d@swipnet.se>
parents:
53823
diff
changeset
|
749 (condition-case info |
59996
aac0a33f5772
Change release version from 21.4 to 22.1 throughout.
Kim F. Storm <storm@cua.dk>
parents:
59932
diff
changeset
|
750 (x-dnd-drop-data event frame window value |
53913
e83b3b3941cf
x-dnd.el: Add COMPOUND_TEXT, handle FILE_NAME correctly, add Motif (CDE)
Jan Djärv <jan.h.d@swipnet.se>
parents:
53823
diff
changeset
|
751 (x-dnd-current-type window)) |
e83b3b3941cf
x-dnd.el: Add COMPOUND_TEXT, handle FILE_NAME correctly, add Motif (CDE)
Jan Djärv <jan.h.d@swipnet.se>
parents:
53823
diff
changeset
|
752 (error |
e83b3b3941cf
x-dnd.el: Add COMPOUND_TEXT, handle FILE_NAME correctly, add Motif (CDE)
Jan Djärv <jan.h.d@swipnet.se>
parents:
53823
diff
changeset
|
753 (message "Error: %s" info) |
e83b3b3941cf
x-dnd.el: Add COMPOUND_TEXT, handle FILE_NAME correctly, add Motif (CDE)
Jan Djärv <jan.h.d@swipnet.se>
parents:
53823
diff
changeset
|
754 nil)))))) |
e83b3b3941cf
x-dnd.el: Add COMPOUND_TEXT, handle FILE_NAME correctly, add Motif (CDE)
Jan Djärv <jan.h.d@swipnet.se>
parents:
53823
diff
changeset
|
755 (x-get-selection-internal |
59996
aac0a33f5772
Change release version from 21.4 to 22.1 throughout.
Kim F. Storm <storm@cua.dk>
parents:
59932
diff
changeset
|
756 (intern atom-name) |
53913
e83b3b3941cf
x-dnd.el: Add COMPOUND_TEXT, handle FILE_NAME correctly, add Motif (CDE)
Jan Djärv <jan.h.d@swipnet.se>
parents:
53823
diff
changeset
|
757 (if action 'XmTRANSFER_SUCCESS 'XmTRANSFER_FAILURE) |
e83b3b3941cf
x-dnd.el: Add COMPOUND_TEXT, handle FILE_NAME correctly, add Motif (CDE)
Jan Djärv <jan.h.d@swipnet.se>
parents:
53823
diff
changeset
|
758 timestamp) |
e83b3b3941cf
x-dnd.el: Add COMPOUND_TEXT, handle FILE_NAME correctly, add Motif (CDE)
Jan Djärv <jan.h.d@swipnet.se>
parents:
53823
diff
changeset
|
759 (x-dnd-forget-drop frame))) |
e83b3b3941cf
x-dnd.el: Add COMPOUND_TEXT, handle FILE_NAME correctly, add Motif (CDE)
Jan Djärv <jan.h.d@swipnet.se>
parents:
53823
diff
changeset
|
760 |
56852
4504840779eb
* x-dnd.el (x-dnd-protocol-alist): Document update.
Jan Djärv <jan.h.d@swipnet.se>
parents:
54986
diff
changeset
|
761 (t (error "Unknown Motif DND message %s %s" message-atom data))))) |
59996
aac0a33f5772
Change release version from 21.4 to 22.1 throughout.
Kim F. Storm <storm@cua.dk>
parents:
59932
diff
changeset
|
762 |
53913
e83b3b3941cf
x-dnd.el: Add COMPOUND_TEXT, handle FILE_NAME correctly, add Motif (CDE)
Jan Djärv <jan.h.d@swipnet.se>
parents:
53823
diff
changeset
|
763 |
e83b3b3941cf
x-dnd.el: Add COMPOUND_TEXT, handle FILE_NAME correctly, add Motif (CDE)
Jan Djärv <jan.h.d@swipnet.se>
parents:
53823
diff
changeset
|
764 ;;; |
e83b3b3941cf
x-dnd.el: Add COMPOUND_TEXT, handle FILE_NAME correctly, add Motif (CDE)
Jan Djärv <jan.h.d@swipnet.se>
parents:
53823
diff
changeset
|
765 |
53789
7efe8089eadf
* x-dnd.el: New file for drag and drop.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
766 (provide 'x-dnd) |
7efe8089eadf
* x-dnd.el: New file for drag and drop.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
767 |
93975
1e3a407766b9
Fix up comment convention on the arch-tag lines.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
87649
diff
changeset
|
768 ;; arch-tag: b621fb7e-50da-4323-850b-5fc71ae64621 |
53789
7efe8089eadf
* x-dnd.el: New file for drag and drop.
Jan Djärv <jan.h.d@swipnet.se>
parents:
diff
changeset
|
769 ;;; x-dnd.el ends here |