diff options
| author | Po Lu | 2022-06-29 10:24:14 +0800 |
|---|---|---|
| committer | Po Lu | 2022-06-29 10:24:14 +0800 |
| commit | 0e6516a1f022e18f4e32848331954deb0e850d4e (patch) | |
| tree | aaf82c350a8aee4ea7867587af7a6555ca6804af /test | |
| parent | 9705609c0ef5e426606300da95fed4bec54923fb (diff) | |
| download | emacs-0e6516a1f022e18f4e32848331954deb0e850d4e.tar.gz emacs-0e6516a1f022e18f4e32848331954deb0e850d4e.zip | |
Fix reported problem with drag-and-drop inside VirtualBox
* lisp/x-dnd.el (x-dnd-handle-old-kde, x-dnd-handle-offix)
(x-dnd-handle-motif): Select window before handling drop, like
on Xdnd.
(x-dnd-convert-to-offix, x-dnd-do-offix-drop)
(x-dnd-handle-unsupported-drop): Accept local selection data and
use that instead.
* src/keyboard.c (kbd_buffer_get_event): Call unsupported drop
function with local selection data as 8th arg.
* src/xselect.c (x_get_local_selection): Accept new arg
`local_value'. All callers changed.
(Fx_get_local_selection): New function.
(syms_of_xselect): Update defsubrs.
* src/xterm.c (x_dnd_lose_ownership): New function.
(x_dnd_begin_drag_and_drop): Unless new variable is true, disown
XdndSelection after returning. This supposedly makes
drag-and-drop from guest to host work in VirtualBox without
causing pointer motion to become choppy afterwards.
(syms_of_xterm): New variable `x_dnd_preserve_selection_data'
and update doc string of `x-dnd-unsupported-drop-function'.
* test/lisp/dnd-tests.el (dnd-tests-begin-text-drag)
(dnd-tests-begin-file-drag, dnd-tests-begin-drag-files): Set new
variable to nil during tests.
Diffstat (limited to 'test')
| -rw-r--r-- | test/lisp/dnd-tests.el | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/test/lisp/dnd-tests.el b/test/lisp/dnd-tests.el index aae9c80273f..18dd55c206c 100644 --- a/test/lisp/dnd-tests.el +++ b/test/lisp/dnd-tests.el | |||
| @@ -38,6 +38,7 @@ | |||
| 38 | "Alist of selection names to their values.") | 38 | "Alist of selection names to their values.") |
| 39 | 39 | ||
| 40 | (defvar x-treat-local-requests-remotely) | 40 | (defvar x-treat-local-requests-remotely) |
| 41 | (defvar x-dnd-preserve-selection-data) | ||
| 41 | 42 | ||
| 42 | ;; Define some replacements for functions used by the drag-and-drop | 43 | ;; Define some replacements for functions used by the drag-and-drop |
| 43 | ;; code on X when running under something else. | 44 | ;; code on X when running under something else. |
| @@ -152,7 +153,8 @@ This function only tries to handle strings." | |||
| 152 | ;; program with reasonably correct behavior, such as dtpad, gedit, | 153 | ;; program with reasonably correct behavior, such as dtpad, gedit, |
| 153 | ;; or Mozilla. | 154 | ;; or Mozilla. |
| 154 | ;; ASCII Latin-1 UTF-8 | 155 | ;; ASCII Latin-1 UTF-8 |
| 155 | (let ((test-text "hello, everyone! sæl öllsömul! всем привет")) | 156 | (let ((test-text "hello, everyone! sæl öllsömul! всем привет") |
| 157 | (x-dnd-preserve-selection-data t)) | ||
| 156 | ;; Verify that dragging works. | 158 | ;; Verify that dragging works. |
| 157 | (should (eq (dnd-begin-text-drag test-text) 'copy)) | 159 | (should (eq (dnd-begin-text-drag test-text) 'copy)) |
| 158 | (should (eq (dnd-begin-text-drag test-text nil 'move) 'move)) | 160 | (should (eq (dnd-begin-text-drag test-text nil 'move) 'move)) |
| @@ -187,7 +189,8 @@ This function only tries to handle strings." | |||
| 187 | (normal-multibyte-file (expand-file-name | 189 | (normal-multibyte-file (expand-file-name |
| 188 | (make-temp-name "тест-на-перетаскивание") | 190 | (make-temp-name "тест-на-перетаскивание") |
| 189 | temporary-file-directory)) | 191 | temporary-file-directory)) |
| 190 | (remote-temp-file (dnd-tests-make-temp-name))) | 192 | (remote-temp-file (dnd-tests-make-temp-name)) |
| 193 | (x-dnd-preserve-selection-data t)) | ||
| 191 | ;; Touch those files if they don't exist. | 194 | ;; Touch those files if they don't exist. |
| 192 | (unless (file-exists-p normal-temp-file) | 195 | (unless (file-exists-p normal-temp-file) |
| 193 | (write-region "" 0 normal-temp-file)) | 196 | (write-region "" 0 normal-temp-file)) |
| @@ -273,7 +276,8 @@ This function only tries to handle strings." | |||
| 273 | (expand-file-name (make-temp-name "dnd-test") | 276 | (expand-file-name (make-temp-name "dnd-test") |
| 274 | temporary-file-directory)) | 277 | temporary-file-directory)) |
| 275 | (nonexistent-remote-file (dnd-tests-make-temp-name)) | 278 | (nonexistent-remote-file (dnd-tests-make-temp-name)) |
| 276 | (nonexistent-remote-file-1 (dnd-tests-make-temp-name))) | 279 | (nonexistent-remote-file-1 (dnd-tests-make-temp-name)) |
| 280 | (x-dnd-preserve-selection-data t)) | ||
| 277 | ;; Touch those files if they don't exist. | 281 | ;; Touch those files if they don't exist. |
| 278 | (unless (file-exists-p normal-temp-file) | 282 | (unless (file-exists-p normal-temp-file) |
| 279 | (write-region "" 0 normal-temp-file)) | 283 | (write-region "" 0 normal-temp-file)) |