diff options
| author | Po Lu | 2022-04-03 19:20:56 +0800 |
|---|---|---|
| committer | Po Lu | 2022-04-03 19:20:56 +0800 |
| commit | 9ccaf35e0b52de2fdf906efe1ae935012745e832 (patch) | |
| tree | 97267d9bc0466c7c301d43716c9d5abe4ff42724 /src | |
| parent | c3f12cd5da54c9d5180fccaeee2e34b05489def2 (diff) | |
| download | emacs-9ccaf35e0b52de2fdf906efe1ae935012745e832.tar.gz emacs-9ccaf35e0b52de2fdf906efe1ae935012745e832.zip | |
Implement `drag-source' values of track-mouse on NS
* src/nsterm.m (ns_mouse_position): Don't return frame when
appropriate.
Diffstat (limited to 'src')
| -rw-r--r-- | src/nsterm.m | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/src/nsterm.m b/src/nsterm.m index f4c1e08925c..15127d53fbf 100644 --- a/src/nsterm.m +++ b/src/nsterm.m | |||
| @@ -2270,6 +2270,7 @@ ns_mouse_position (struct frame **fp, int insist, Lisp_Object *bar_window, | |||
| 2270 | Lisp_Object frame, tail; | 2270 | Lisp_Object frame, tail; |
| 2271 | struct frame *f = NULL; | 2271 | struct frame *f = NULL; |
| 2272 | struct ns_display_info *dpyinfo; | 2272 | struct ns_display_info *dpyinfo; |
| 2273 | bool return_no_frame_flag = false; | ||
| 2273 | 2274 | ||
| 2274 | NSTRACE ("ns_mouse_position"); | 2275 | NSTRACE ("ns_mouse_position"); |
| 2275 | 2276 | ||
| @@ -2313,15 +2314,25 @@ ns_mouse_position (struct frame **fp, int insist, Lisp_Object *bar_window, | |||
| 2313 | #endif | 2314 | #endif |
| 2314 | 2315 | ||
| 2315 | if (!f) | 2316 | if (!f) |
| 2316 | f = dpyinfo->ns_focus_frame ? dpyinfo->ns_focus_frame : SELECTED_FRAME (); | 2317 | { |
| 2318 | f = (dpyinfo->ns_focus_frame | ||
| 2319 | ? dpyinfo->ns_focus_frame : SELECTED_FRAME ()); | ||
| 2320 | return_no_frame_flag = EQ (track_mouse, Qdrag_source); | ||
| 2321 | } | ||
| 2322 | |||
| 2323 | if (!FRAME_NS_P (f)) | ||
| 2324 | f = NULL; | ||
| 2317 | 2325 | ||
| 2318 | /* While dropping, use the last mouse frame only if there is no | 2326 | /* While dropping, use the last mouse frame only if there is no |
| 2319 | currently focused frame. */ | 2327 | currently focused frame. */ |
| 2320 | if (!f | 2328 | if (!f && (EQ (track_mouse, Qdropping) |
| 2321 | && EQ (track_mouse, Qdropping) | 2329 | || EQ (track_mouse, Qdrag_source)) |
| 2322 | && dpyinfo->last_mouse_frame | 2330 | && dpyinfo->last_mouse_frame |
| 2323 | && FRAME_LIVE_P (dpyinfo->last_mouse_frame)) | 2331 | && FRAME_LIVE_P (dpyinfo->last_mouse_frame)) |
| 2324 | f = dpyinfo->last_mouse_frame; | 2332 | { |
| 2333 | f = dpyinfo->last_mouse_frame; | ||
| 2334 | return_no_frame_flag = EQ (track_mouse, Qdrag_source); | ||
| 2335 | } | ||
| 2325 | 2336 | ||
| 2326 | if (f && FRAME_NS_P (f)) | 2337 | if (f && FRAME_NS_P (f)) |
| 2327 | { | 2338 | { |
| @@ -2340,7 +2351,7 @@ ns_mouse_position (struct frame **fp, int insist, Lisp_Object *bar_window, | |||
| 2340 | if (y) XSETINT (*y, lrint (view_position.y)); | 2351 | if (y) XSETINT (*y, lrint (view_position.y)); |
| 2341 | if (time) | 2352 | if (time) |
| 2342 | *time = dpyinfo->last_mouse_movement_time; | 2353 | *time = dpyinfo->last_mouse_movement_time; |
| 2343 | *fp = f; | 2354 | *fp = return_no_frame_flag ? NULL : f; |
| 2344 | } | 2355 | } |
| 2345 | 2356 | ||
| 2346 | unblock_input (); | 2357 | unblock_input (); |