diff options
Diffstat (limited to 'lisp/mouse.el')
| -rw-r--r-- | lisp/mouse.el | 59 |
1 files changed, 27 insertions, 32 deletions
diff --git a/lisp/mouse.el b/lisp/mouse.el index 538e6a500bb..9c7bf6f9c36 100644 --- a/lisp/mouse.el +++ b/lisp/mouse.el | |||
| @@ -425,7 +425,7 @@ must be one of the symbols `header', `mode', or `vertical'." | |||
| 425 | (frame-parameters frame))) | 425 | (frame-parameters frame))) |
| 426 | 'right))) | 426 | 'right))) |
| 427 | (draggable t) | 427 | (draggable t) |
| 428 | finished event position growth dragged) | 428 | event position growth dragged) |
| 429 | (cond | 429 | (cond |
| 430 | ((eq line 'header) | 430 | ((eq line 'header) |
| 431 | ;; Check whether header-line can be dragged at all. | 431 | ;; Check whether header-line can be dragged at all. |
| @@ -456,39 +456,33 @@ must be one of the symbols `header', `mode', or `vertical'." | |||
| 456 | 456 | ||
| 457 | ;; Start tracking. | 457 | ;; Start tracking. |
| 458 | (track-mouse | 458 | (track-mouse |
| 459 | ;; Loop reading events and sampling the position of the mouse. | 459 | ;; Loop reading events and sampling the position of the mouse, |
| 460 | (while (not finished) | 460 | ;; until there is a non-mouse-movement event. Also, |
| 461 | (setq event (read-event)) | 461 | ;; scroll-bar-movement events are the same as mouse movement for |
| 462 | ;; our purposes. (Why? -- cyd) | ||
| 463 | ;; If you change this, check that all of the following still work: | ||
| 464 | ;; Resizing windows by dragging mode-lines and header lines, | ||
| 465 | ;; and vertical lines (in windows without scroll bars). | ||
| 466 | ;; Doing this should not select another window, even if | ||
| 467 | ;; mouse-autoselect-window is non-nil. | ||
| 468 | ;; Mouse-1 clicks in Info header lines should advance position | ||
| 469 | ;; by one node at a time if mouse-1-click-follows-link is non-nil, | ||
| 470 | ;; otherwise they should just select the window. | ||
| 471 | (while (progn | ||
| 472 | (setq event (read-event)) | ||
| 473 | (memq (car-safe event) | ||
| 474 | '(mouse-movement scroll-bar-movement | ||
| 475 | switch-frame select-window))) | ||
| 462 | (setq position (mouse-position)) | 476 | (setq position (mouse-position)) |
| 463 | ;; Do nothing if | 477 | ;; Do nothing if |
| 464 | ;; - there is a switch-frame event. | 478 | ;; - there is a switch-frame event. |
| 465 | ;; - the mouse isn't in the frame that we started in | 479 | ;; - the mouse isn't in the frame that we started in |
| 466 | ;; - the mouse isn't in any Emacs frame | 480 | ;; - the mouse isn't in any Emacs frame |
| 467 | ;; Drag if | ||
| 468 | ;; - there is a mouse-movement event | ||
| 469 | ;; - there is a scroll-bar-movement event (Why? -- cyd) | ||
| 470 | ;; (same as mouse movement for our purposes) | ||
| 471 | ;; Quit if | ||
| 472 | ;; - there is a keyboard event or some other unknown event. | ||
| 473 | (cond | 481 | (cond |
| 474 | ((not (consp event)) | ||
| 475 | (setq finished t)) | ||
| 476 | ((memq (car event) '(switch-frame select-window)) | 482 | ((memq (car event) '(switch-frame select-window)) |
| 477 | nil) | 483 | nil) |
| 478 | ((not (memq (car event) '(mouse-movement scroll-bar-movement))) | 484 | ((not (and (eq (car position) frame) |
| 479 | (when (consp event) | 485 | (cadr position))) |
| 480 | ;; Do not unread a drag-mouse-1 event to avoid selecting | ||
| 481 | ;; some other window. For vertical line dragging do not | ||
| 482 | ;; unread mouse-1 events either (but only if we dragged at | ||
| 483 | ;; least once to allow mouse-1 clicks get through). | ||
| 484 | (unless (and dragged | ||
| 485 | (if (eq line 'vertical) | ||
| 486 | (memq (car event) '(drag-mouse-1 mouse-1)) | ||
| 487 | (eq (car event) 'drag-mouse-1))) | ||
| 488 | (push event unread-command-events))) | ||
| 489 | (setq finished t)) | ||
| 490 | ((not (and (eq (car position) frame) | ||
| 491 | (cadr position))) | ||
| 492 | nil) | 486 | nil) |
| 493 | ((eq line 'vertical) | 487 | ((eq line 'vertical) |
| 494 | ;; Drag vertical divider. | 488 | ;; Drag vertical divider. |
| @@ -512,12 +506,13 @@ must be one of the symbols `header', `mode', or `vertical'." | |||
| 512 | growth | 506 | growth |
| 513 | (- growth))))))) | 507 | (- growth))))))) |
| 514 | ;; Process the terminating event. | 508 | ;; Process the terminating event. |
| 515 | (when (and (mouse-event-p event) on-link (not dragged) | 509 | (unless dragged |
| 516 | (mouse--remap-link-click-p start-event event)) | 510 | (when (and (mouse-event-p event) on-link |
| 517 | ;; If mouse-2 has never been done by the user, it doesn't have | 511 | (mouse--remap-link-click-p start-event event)) |
| 518 | ;; the necessary property to be interpreted correctly. | 512 | ;; If mouse-2 has never been done by the user, it doesn't have |
| 519 | (put 'mouse-2 'event-kind 'mouse-click) | 513 | ;; the necessary property to be interpreted correctly. |
| 520 | (setcar event 'mouse-2) | 514 | (put 'mouse-2 'event-kind 'mouse-click) |
| 515 | (setcar event 'mouse-2)) | ||
| 521 | (push event unread-command-events)))) | 516 | (push event unread-command-events)))) |
| 522 | 517 | ||
| 523 | (defun mouse-drag-mode-line (start-event) | 518 | (defun mouse-drag-mode-line (start-event) |