diff options
author | Martin Rudalics <rudalics@gmx.at> | 2019-08-04 09:21:18 +0200 |
---|---|---|
committer | Martin Rudalics <rudalics@gmx.at> | 2019-08-04 09:21:18 +0200 |
commit | 5ec3f70527e330abf4c0c3519fa4914c5f094358 (patch) | |
tree | 3e91fb7a326694d8b46cf9f1ed4e548ce4f7f19d /src/w32fns.c | |
parent | 01661f33c11654d1fe5fe1013332db2500b7f449 (diff) | |
download | emacs-5ec3f70527e330abf4c0c3519fa4914c5f094358.tar.gz emacs-5ec3f70527e330abf4c0c3519fa4914c5f094358.tar.bz2 emacs-5ec3f70527e330abf4c0c3519fa4914c5f094358.zip |
Fix two mouse drag and drop issues (Bug#28620, Bug#36269)
Allow 'mouse-drag-and-drop-region' to move/copy text from one
frame to another (Bug#28620). Prevent mouse avoidance mode from
interfering with 'mouse-drag-and-drop-region' (Bug#36269).
* lisp/avoid.el (mouse-avoidance-ignore-p): Suspend avoidance
when 'track-mouse' equals 'dropping'.
* lisp/mouse.el (mouse-drag-and-drop-region): Set
'track-mouse' to 'dropping'. Continue reading events also
when switching frames.
* src/keyboard.c (Finternal_track_mouse): Rename from
Ftrack_mouse.
(some_mouse_moved): Return NULL also when mouse is not tracked.
(show_help_echo, readable_events, kbd_buffer_get_event): Don't
check whether mouse is tracked, some_mouse_moved does it now.
(track_mouse): Rename variable from do_mouse_tracking. Adjust
all users. In doc-string explain meanings of special values
'dragging' and 'dropping'.
* src/nsterm.m (ns_mouse_position): During drag and drop
consider last mouse frame only when there is no currently
focused frame.
* src/w32fns.c (w32_wnd_proc): Don't set mouse capture during a
drag and drop operation.
* src/w32term.c (w32_mouse_position): Track frame under mouse
during mouse drag and drop.
(mouse_or_wdesc_frame): New function.
(w32_read_socket): Call mouse_or_wdesc_frame on mouse events.
* src/xdisp.c (define_frame_cursor1): Don't change mouse cursor
shape during mouse drag and drop.
(syms_of_xdisp): New symbol Qdropping.
* src/xterm.c (XTmouse_position): Allow mouse drag and drop move
to another frame
(mouse_or_wdesc_frame): New function.
(handle_one_xevent): Use mouse_or_wdesc_frame for mouse events.
Diffstat (limited to 'src/w32fns.c')
-rw-r--r-- | src/w32fns.c | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/src/w32fns.c b/src/w32fns.c index acd9c80528a..a2a88b25881 100644 --- a/src/w32fns.c +++ b/src/w32fns.c @@ -4586,7 +4586,8 @@ w32_wnd_proc (HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) if (button_state & this) return 0; - if (button_state == 0) + /* Don't capture mouse when dropping. */ + if (button_state == 0 && !EQ (track_mouse, Qdropping)) SetCapture (hwnd); button_state |= this; @@ -4707,8 +4708,11 @@ w32_wnd_proc (HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) if (parse_button (msg, HIWORD (wParam), &button, &up)) { - if (up) ReleaseCapture (); - else SetCapture (hwnd); + if (up) + ReleaseCapture (); + /* Don't capture mouse when dropping. */ + else if (!EQ (track_mouse, Qdropping)) + SetCapture (hwnd); button = (button == 0) ? LMOUSE : ((button == 1) ? MMOUSE : RMOUSE); if (up) @@ -5351,8 +5355,9 @@ w32_wnd_proc (HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) else if (button_state & RMOUSE) flags |= TPM_RIGHTBUTTON; - /* Remember we did a SetCapture on the initial mouse down event, - so for safety, we make sure the capture is canceled now. */ + /* We may have done a SetCapture on the initial mouse down + event, so for safety, make sure the capture is canceled + now. */ ReleaseCapture (); button_state = 0; |